databroker icon indicating copy to clipboard operation
databroker copied to clipboard

You can get a resource from a different run

Open gwbischof opened this issue 5 years ago • 0 comments

In some cases resource uids are not unique. We plan to enforce uniqueness of resource uid in the future. In the example below, we read the run with datakbroker v0, and v2 and we get different resource documents. The documents have the same uid, but different run_start. The run_start of the returned resource should match the uid of the run being read.

    def test_compare_canonical(v0_cat, v1_cat, v2_cat, run, beamline):
        compare(v1_cat[run].documents(), v0_cat[run].documents(), remove_ok=True)
>       compare(v2_cat[run].canonical(fill='no'), v0_cat[run].documents(), remove_ok=True)
databroker-nsls2-tests/tests/generic.py:90: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
a = <generator object BlueskyRun.canonical at 0x7f6519c84550>, b = <generator object Header.documents at 0x7f6519c84450>, remove_ok = True
    def compare(a, b, remove_ok=False):
        """
        Check that there is no differences between Bluesky runs a and b.
        Setting remove_ok to True means that it is ok for a to have more
        information than run b.
        """
        run_a = index(normalize(a))
        run_b = index(normalize(b))
        if remove_ok:
            difference = [item for item in diff(run_a, run_b) if item[0]!='remove']
        else:
            difference = list(diff(run_a, run_b))
>       assert not difference
E       AssertionError
databroker-nsls2-tests/tests/generic.py:64: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/gbischof/dama/databroker-nsls2-tests/databroker-nsls2-tests/tests/generic.py(64)compare()
-> assert not difference
(Pdb) difference
[('change', [('resource', 'bc05c6d7-7738-46f9-abb7-bd43ff90017e'), 'run_start'], ('26ee4ade-5645-4dd0-8937-0664110666f1', '6307c9b0-6482-467d-ae9a-464143f70a29'))]

gwbischof avatar Feb 20 '20 16:02 gwbischof