Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take out unnecessary Job.save() #1217

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions gateway/api/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,25 +168,13 @@ def save(
Job instance
"""

job = None
try:
job = Job(
program=program,
arguments=arguments,
author=author,
status=status,
config=jobconfig,
)
job.save()
except (Exception) as save_job_exception:
logger.error(
"Exception was caught saving a Job. \n Error trace: %s",
save_job_exception,
)
raise InternalServerErrorException(
"Unexpected error saving a job"
) from save_job_exception

job = Job(
program=program,
arguments=arguments,
author=author,
status=status,
config=jobconfig,
)
env = encrypt_env_vars(build_env_variables(token, job, json.dumps(arguments)))
try:
env["traceparent"] = carrier["traceparent"]
Expand All @@ -198,7 +186,7 @@ def save(
job.save()
except (Exception) as save_job_exception:
logger.error(
"Exception was caught saving the env_vars of the Job[%s]. \n Error trace: %s",
"Exception was caught saving the Job[%s]. \n Error trace: %s",
job.id,
save_job_exception,
)
Expand Down
Loading