Skip to content

Commit d2bd632

Browse files
committed
minor cleanup
1 parent 30cad74 commit d2bd632

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

services/web/server/src/simcore_service_webserver/functions/_function_jobs_repository.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,18 @@ async def patch_function_job(
169169
product_name=product_name,
170170
function_job_id=patch_input.uid,
171171
)
172+
if job.function_class != used_function_class:
173+
raise FunctionJobPatchModelIncompatibleError(
174+
function_id=job.function_uuid, product_name=product_name
175+
)
176+
172177
class_specific_data = _update_class_specific_data(
173178
class_specific_data=job.class_specific_data, patch=patch_input.patch
174179
)
175180

176181
result = await transaction.execute(
177182
function_jobs_table.update()
178183
.where(function_jobs_table.c.uuid == f"{patch_input.uid}")
179-
.where(
180-
function_jobs_table.c.function_class == used_function_class.value
181-
)
182184
.values(
183185
inputs=patch_input.patch.inputs,
184186
outputs=patch_input.patch.outputs,
@@ -189,12 +191,7 @@ async def patch_function_job(
189191
)
190192
.returning(*_FUNCTION_JOBS_TABLE_COLS)
191193
)
192-
row = result.one_or_none()
193-
if row is None:
194-
raise FunctionJobPatchModelIncompatibleError(
195-
function_id=job.function_uuid, product_name=product_name
196-
)
197-
updated_jobs.append(RegisteredFunctionJobDB.model_validate(row))
194+
updated_jobs.append(RegisteredFunctionJobDB.model_validate(result.one()))
198195

199196
return updated_jobs
200197

0 commit comments

Comments
 (0)