Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

DMF example(s) fail with NameError: name 'dmf_params' is not defined #122

@lbianchi-lbl

Description

@lbianchi-lbl

See e.g. https://github.com/IDAES/idaes-pse/runs/7198611013?check_suite_focus=true

 ------------------
# save to DMF
# create resources
name = "BT NRTL est param1"
ds_s1 = _dmf.find_one(name=name)
if not ds_s1:
    ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
                                                                         {'tau': {'benzene,toluene': dmf_params["1:bt"],
                                                                                  'toluene,benzene': dmf_params["1:tb"]}}})
    create_relation(ds_s1, Predicates.derived, ds_splits[0])
name = "BT NRTL est param2"
ds_s2 = _dmf.find_one(name=name)
if not ds_s2:
    ds_s2 = _dmf.new(name=name, desc="Solution for data subset 2", data={'SSE': obj_value_2, 'parameters': 
                                                                         {'tau': {'benzene,toluene': dmf_params["2:bt"],
                                                                                  'toluene,benzene': dmf_params["2:tb"]}}})
    create_relation(ds_s2, Predicates.derived, ds_splits[1])
# save relations (prints number of objects processed)
_dmf.update()
------------------
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5112/4039786833.py in <cell line: 5>()
      5ifnotds_s1:
      6     ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
----> 7                                                                          {'tau': {'benzene,toluene': dmf_params["1:bt"],
      8                                                                                   'toluene,benzene': dmf_params["1:tb"]}}})
      9create_relation(ds_s1,Predicates.derived,ds_splits[0])
NameError: name 'dmf_params' is not defined

Looking at recent commits, it seems eb4d22d might be related with this error; more specifically, moving the definition of dmf_params to a cell having the testing and/or remove_cell tags, which causes it to be undefined when the cell is removed during certain modes of programmatic execution such as the one used for the idaes-pse "Run notebooks" CI checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions