Skip to content

JSONDecodeError #113

@ATNoName

Description

@ATNoName

Issue Type

Bug

Source

source

Bifrost Version

0.8

Custom Code

No

OS Platform and Distribution

Windows 10 Home

Mobile device

No response

Python version

3.9

Current Behaviour?

Running bifrost_demo.py gives me a JSON Decode like this

image

the bifrost_demo.py is this:

# installing bifrost:
#   install Node.js 14 or 16 
#   pip install git+https://github.com/Distributive-Network/Bifrost


# DCP MODULE
from bifrost import dcp

# input_set : array containing arbitary, enumerable elements.
b_set = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]

# work_function : function that will be mapped to each element in the input_set.
"Compute left Riemann sum of exp(-x^2) from 0 to b with N subintervals."
def riemann_sum(b,N=100000):

  # libraries required inside the work_function must be imported inside the work_function
  import numpy as np

  x = np.linspace(0,b,N+1)
  x_left_endpoints = x[:-1]
  Delta_x = b/N
  answer = Delta_x * np.sum(np.exp(-x_left_endpoints**2))

  return b, answer


# DCP Job definition, configuration, and execution
job = dcp.compute_for(b_set, riemann_sum)   # maps remann_sum to each element in b_set

job.requires('numpy')  # the work_function requires numpy
job.compute_groups = [{'joinKey': 'dan', 'joinSecret': 'dcp'}]  # open dcp.work/demo with join secret dcp to compute!
job.public['name'] = "My Numpy Riemann Sums Job, on DCP!"   # the job name that appears in the progress bars

results = job.exec(0.001)  # launch the job and debit 0.001 compute credits per slice (0.001 is the min)

# print the results
for result in results:
  print(result)

Standalone code to reproduce the issue

Just run bifrost_demo.py on the machine specified.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions