Skip to content

Commit

Permalink
fix: workaround for function name
Browse files Browse the repository at this point in the history
Signed-off-by: SdgJlbl <sarah.diot-girard@owkin.com>
  • Loading branch information
SdgJlbl committed Oct 20, 2023
1 parent f8bbd29 commit 678812d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/substrapp/tasks/tasks_save_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ def on_success(self, retval: dict[str, Any], task_id: str, args: tuple, kwargs:
function_key, channel_name = self.get_task_info(args, kwargs)

function_image = FunctionImage.objects.get(function=function_key)
# needed because the name is not an optional parameter
api_function = ApiFunction.objects.get(key=function_key)
orc_function = {
"key": str(function_key),
# TODO find a way to propagate the name or make it optional at update
"name": "function name",
"name": api_function.name,
"image": {
"checksum": function_image.checksum,
# TODO check url
"storage_address": settings.DEFAULT_DOMAIN + reverse("api:function-image", args=[function_key]),
},
}

with get_orchestrator_client(channel_name) as client:
# TODO atomicity?
# TODO atomiticy
client.update_function(orc_function)
client.update_function_status(
function_key=function_key, action=orchestrator.function_pb2.FUNCTION_ACTION_READY
Expand Down

0 comments on commit 678812d

Please sign in to comment.