Skip to content

not JSON serializable error when running flow on a task #477

Description

@dbehrouz

Description

I encounter the following error when running a flow (for example 7103) on a task (for example 146607).
<openml.flows.flow.OpenMLFlow object at 0x11cc43110> is not JSON serializable

Steps/Code to Reproduce

Example:

importopenmlflow=openml.flows.get_flow(7103)
task=openml.tasks.get_task(146607)
run=runs.run_flow_on_task(task, flow)

Expected Results

OpenMLRun object

Actual Results

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-102-f7fb112d9304> in <module>()
----> 1 run = runs.run_flow_on_task(task, flow)
/usr/local/lib/python2.7/site-packages/openml-0.7.0-py2.7.egg/openml/runs/functions.pyc in run_flow_on_task(task, flow, avoid_duplicate_runs, flow_tags, seed)
85 if avoid_duplicate_runs and flow_id:
86 flow_from_server = get_flow(flow_id)
---> 87 setup_id = setup_exists(flow_from_server, flow.model)
88 ids = _run_exists(task.task_id, setup_id)
89 if ids:
/usr/local/lib/python2.7/site-packages/openml-0.7.0-py2.7.egg/openml/setups/functions.pyc in setup_exists(flow, model)
44 raise ValueError('This should not happen!')
45 ---> 46 openml_param_settings = openml.runs.OpenMLRun._parse_parameters(flow, model)
47 description = xmltodict.unparse(_to_dict(flow.flow_id,
48 openml_param_settings),
/usr/local/lib/python2.7/site-packages/openml-0.7.0-py2.7.egg/openml/runs/run.pyc in _parse_parameters(flow, model)
360 flow_dict = get_flow_dict(flow)
361 parameters = extract_parameters(flow, flow_dict, model,
--> 362 True, flow.flow_id)
363 364 return parameters
/usr/local/lib/python2.7/site-packages/openml-0.7.0-py2.7.egg/openml/runs/run.pyc in extract_parameters(_flow, _flow_dict, component_model, _main_call, main_id)
340 raise e
341 elif not isinstance(step, openml.flows.OpenMLFlow):
--> 342 raise e
343 continue
344 else:
TypeError: <openml.flows.flow.OpenMLFlow object at 0x11cc43110> is not JSON serializable

Versions

Darwin-17.5.0-x86_64-i386-64bit
('Python', '2.7.15 (default, May 28 2018, 14:20:45) \n[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]')
('NumPy', '1.13.3')
('SciPy', '1.0.0')
('Scikit-Learn', '0.18.1')
('OpenML', '0.7.0')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions