Distributive-Network / Bifrost

An SHM/memmap based python and node communication/evaluation tool.
Other
7 stars 2 forks source link

Dictionary shared arguments break DCP Javascript workload #97

Open ccmcintyre-kingsds opened 2 years ago

ccmcintyre-kingsds commented 2 years ago

Issue Type

Bug

Source

source

Bifrost Version

0.6.1

Custom Code

No

OS Platform and Distribution

Linux Ubuntu 20.04

Mobile device

No response

Python version

3.8

Current Behaviour?

Keyword arguments, which are an acceptable input format coming from a Pythonic context, are immediately breaking when the work function has been specified as being in javascript. We should be able to handle and proceed with this case; the intended behaviour is to treat them as essentially being positional arguments, for javascript's purposes. Clearly this behaviour as implemented, though, needs at least cursory bugfixing, given the error that even the simple case of it invokes before even reaching job deployment.

Standalone code to reproduce the issue

from bifrost import dcp

work_function = """function workFunction( n, x ){ return n * x }"""

input_set = range(5)
shared_arguments = { "x": 3 }

job = dcp.compute_for(input_set, work_function, shared_arguments)
job.node_js = True

output_set = job.exec()
print(output_set)

Relevant log output

installing dcp-client
Traceback (most recent call last):
  File "issue_js.py", line 11, in <module>
    output_set = job.exec()
  File "/home/chris/anaconda3/lib/python3.8/site-packages/bifrost/dcp/Job.py", line 461, in exec
    results = self.__dcp_run()
  File "/home/chris/anaconda3/lib/python3.8/site-packages/bifrost/dcp/Job.py", line 251, in __dcp_run
    self.work_arguments.append(self.work_key_arguments)
AttributeError: 'Job' object has no attribute 'work_key_arguments'