Skip to content

Enhance dataset lookup and improve job message handling - #841

Merged
tmaeno merged 3 commits into
PanDAWMS:masterfrom
tmaeno:master
Oct 29, 2026
Merged

tmaeno merged 3 commits into
PanDAWMS:masterfrom
tmaeno:master

Conversation

@tmaeno

@tmaeno tmaeno commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

This pull request refines the get_datasets_by_name API to more accurately handle dataset name lookups, ensuring both scoped and unscoped forms are considered, and updates related documentation, error handling, and tests accordingly. It also improves type annotations and code clarity in several modules.

Improvements to dataset name lookup logic and API:

  • The API now looks up each dataset name in both its scoped and unscoped forms, ensuring that datasets are found regardless of the form used during their creation. Shared forms between names are deduplicated for efficiency. The response now includes which original names each row answers, and the documentation and error messages are updated to reflect these changes. (pandaserver/api/v1/job_api.py, pandaserver/api/v1/tests/job_api_tests.py) [1] [2] [3] [4] [5] [6] [7] [8]

Enhancements to typing and code clarity:

  • Type annotations are improved across several files, especially for shared interfaces and result objects, using TYPE_CHECKING to avoid circular imports and runtime issues. (pandaserver/daemons/utils.py, pandaserver/dataservice/adder_gen.py, pandaserver/srvcore/srv_msg_utils.py) [1] [2] [3] [4] [5] [6] [7] [8]

Minor code and initialization fixes:

  • The initialization of queueData in the scheduler cache is corrected to an empty list for consistency with expected usage. (pandaserver/daemons/scripts/cache_schedconfig.py) [1] [2]

job/get_datasets_by_name read ATLAS_PANDA.Datasets by the names as
given, but a dataset's row can be under either scope:name or name.
insertDataset skips a dataset whose vuid is already in the table, and
the vuid is md5(scope:name) whichever form the name came in, so the
table keeps one row per dataset under the form its first writer used:
the prodDBlock of an input, which may carry a scope, or the
destinationDBlock of an output. A caller asking with the other form
got no row, and the live harness had to send both forms itself.

Each name is now looked up as given and in its other form: a scoped
name also without its scope, and an unscoped one also with the scope
extract_scope gives, which is the scope the vuid is made with. Every
row says in asked_as which given names it answers. The IN-list cap and
the probe budget count these keys, and the answers carry
keys_per_name, so a call may give budget // (keys_per_name *
partitions) names, 100 on production's 5 partitions instead of 200.
getJobs removes a push job's message from panda_pilot_queue after
committing the job, but get_mb_proxy returns None when that queue is
not configured or the message broker setup failed in this process, and
the call went ahead without checking. The AttributeError reached the
outer except after the commit, so getJobs rolled back nothing and
returned no jobs, leaving every job committed so far in that call sent
but handed to no pilot. The other two senders already check the proxy;
this one now does the same and logs that the queue is not configured.
get_mb_proxy returns the MBSenderProxy that start_passive_mode put
under the channel, or None, but was declared Any, as were the senders
in srv_msg_utils that take its result and the workflow manager's own
mb_proxy. They are now MBSenderProxy, imported under TYPE_CHECKING
since msg_bkr_utils sets up its loggers and imports stomp on import.
CI's mypy does not install panda-common, so there the name is still
Any; with panda-common 0.1.11 visible the tree reports nothing new.

Three fields whose class was only in a comment now carry it:
DaemonMaster.tbif is a TaskBufferInterface or None, AdderGen.add_result
an AdderResult or None, and cacheSchedConfig.queueData the list of
dicts query_column_sql builds. queueData starts as an empty list rather
than None; its only reader, main, calls getQueueData first.
@tmaeno
tmaeno merged commit 32907fe into PanDAWMS:master Oct 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant