Skip to content

Cannot push a C++ algorithm

Looks like when pushing a C++ algorithm, the code fails with:

  lib/python3.7/site-packages/click/core.py(829)__call__()
    828         """Alias for :meth:`main`."""
--> 829         return self.main(*args, **kwargs)
    830 

  lib/python3.7/site-packages/click/core.py(782)main()
    781                 with self.make_context(prog_name, args, **extra) as ctx:
--> 782                     rv = self.invoke(ctx)
    783                     if not standalone_mode:

  lib/python3.7/site-packages/click/core.py(1259)invoke()
   1258                 with sub_ctx:
-> 1259                     return _process_result(sub_ctx.command.invoke(sub_ctx))
   1260 

  lib/python3.7/site-packages/click/core.py(1259)invoke()
   1258                 with sub_ctx:
-> 1259                     return _process_result(sub_ctx.command.invoke(sub_ctx))
   1260 

  lib/python3.7/site-packages/beat/cmdline/click_helper.py(121)invoke()
    119 
    120         ctx.meta["asset_info"] = self.asset_info
--> 121         return super().invoke(ctx)

  lib/python3.7/site-packages/click/core.py(1066)invoke()
   1065         if self.callback is not None:
-> 1066             return ctx.invoke(self.callback, **ctx.params)
   1067 

  lib/python3.7/site-packages/click/core.py(610)invoke()
    609             with ctx:
--> 610                 return callback(*args, **kwargs)
    611 

  lib/python3.7/site-packages/click/decorators.py(21)new_func()
     20     def new_func(*args, **kwargs):
---> 21         return f(get_current_context(), *args, **kwargs)
     22 

  lib/python3.7/site-packages/beat/cmdline/decorators.py(94)_decorator()
     93     def _decorator(*args, **kwargs):
---> 94         value = view_func(*args, **kwargs)
     95         if value not in [None, 0]:

  lib/python3.7/site-packages/beat/cmdline/commands.py(321)push_impl()
    320             dry_run=dry_run,
--> 321             indentation=0,
    322         )

  lib/python3.7/site-packages/beat/cmdline/common.py(1486)push()
   1485             try:
-> 1486                 webapi.post(url, data=message)
   1487             except RuntimeError as e:

> lib/python3.7/site-packages/beat/cmdline/webapi.py(104)post()
    103         url = self.__build_url(path)
--> 104         answer = requests.post(url, json=data, headers=self._make_headers())
    105 

  lib/python3.7/site-packages/requests/api.py(119)post()
    118 
--> 119     return request('post', url, data=data, json=json, **kwargs)
    120 

  lib/python3.7/site-packages/requests/api.py(61)request()
     60     with sessions.Session() as session:
---> 61         return session.request(method=method, url=url, **kwargs)
     62 

  lib/python3.7/site-packages/requests/sessions.py(516)request()
    515         )
--> 516         prep = self.prepare_request(req)
    517 

  lib/python3.7/site-packages/requests/sessions.py(459)prepare_request()
    458             cookies=merged_cookies,
--> 459             hooks=merge_hooks(request.hooks, self.hooks),
    460         )

  lib/python3.7/site-packages/requests/models.py(317)prepare()
    316         self.prepare_cookies(cookies)
--> 317         self.prepare_body(data, files, json)
    318         self.prepare_auth(auth, url)

  lib/python3.7/site-packages/requests/models.py(467)prepare_body()
    466             content_type = 'application/json'
--> 467             body = complexjson.dumps(json)
    468             if not isinstance(body, bytes):

  lib/python3.7/site-packages/simplejson/__init__.py(395)dumps()
    394     ):
--> 395         return _default_encoder.encode(obj)
    396     if cls is None:

  lib/python3.7/site-packages/simplejson/encoder.py(296)encode()
    295         # equivalent to the PySequence_Fast that ''.join() would do.
--> 296         chunks = self.iterencode(o, _one_shot=True)
    297         if not isinstance(chunks, (list, tuple)):

  lib/python3.7/site-packages/simplejson/encoder.py(378)iterencode()
    377         try:
--> 378             return _iterencode(o, 0)
    379         finally:

I will not attach the binary the .so file (can be found in https://filesender.switch.ch/filesender/?vid=59e1dbc9-04e4-67c8-2bb1-00007d77b3bb but you don't need that)

Steps to reproduce:

  • create an algorithm with this .json file 1.json
  • generate a random binary file for this alg and save it as 1.so for example this: 1.so
  • push it to the online platform