Only save the job once when creating it (#2289)

* Convert exception to warning

* don't save job before creating the log container

* same as the python code

* test fix

* format

* format

* don't schedule the task if the log container is missing
This commit is contained in:
Cheick Keita
2022-08-24 10:19:18 -07:00
committed by GitHub
parent 07fb794f8a
commit 39e22b060a
4 changed files with 13 additions and 12 deletions

View File

@ -3,6 +3,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from uuid import uuid4
import azure.functions as func
from onefuzztypes.enums import ContainerType, ErrorCode, JobState
from onefuzztypes.models import Error, JobConfig, JobTaskInfo
@ -53,9 +55,7 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
if isinstance(user_info, Error):
return not_ok(user_info, context="jobs create")
job = Job(config=request, user_info=user_info)
job.save()
job = Job(job_id=uuid4(), config=request, user_info=user_info)
# create the job logs container
log_container_sas = create_container(
Container(f"logs-{job.job_id}"),