Commit 9e74c1db authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Two-step process for pushing cxx algorithms

Fixes #73
parent 8ecb434a
...@@ -42,7 +42,6 @@ import fnmatch ...@@ -42,7 +42,6 @@ import fnmatch
import glob import glob
import logging import logging
import os import os
from enum import Enum from enum import Enum
from enum import unique from enum import unique
...@@ -1469,6 +1468,10 @@ def push( ...@@ -1469,6 +1468,10 @@ def push(
url = "/api/v1/%s/%s/" % (TYPE_PLURAL[asset_type], webapi.user) url = "/api/v1/%s/%s/" % (TYPE_PLURAL[asset_type], webapi.user)
# C++ algorithms must be sent in two steps (see below)
if asset_type == "algorithm" and storage.language == "cxx":
cxx_code = message.pop("code")
# sends the data # sends the data
if ( if (
modification_status == ModificationStatus.LOCAL_ONLY_AVAILABLE modification_status == ModificationStatus.LOCAL_ONLY_AVAILABLE
...@@ -1506,6 +1509,14 @@ def push( ...@@ -1506,6 +1509,14 @@ def push(
else: else:
logger.info("Successfuly updated `%s'", asset_name) logger.info("Successfuly updated `%s'", asset_name)
# C++ algorithms must be sent in two steps, we send the binary file now
if asset_type == "algorithm" and storage.language == "cxx":
webapi.post_v2(
f"/api/v1/{TYPE_PLURAL[asset_type]}/{webapi.user}/{storage.name}/{storage.version}/binary/",
data=cxx_code,
extra_header={"Content-Type": "application/octet-stream"},
)
return 0 return 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment