Skip to content

Publish stf_processed on end of processing - #71

Merged
veprbl merged 2 commits into
mainfrom
pr/stf_processed
Aug 25, 2026
Merged

Publish stf_processed on end of processing#71
veprbl merged 2 commits into
mainfrom
pr/stf_processed

Conversation

@veprbl

@veprbl veprbl commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@veprbl
veprbl requested review from zhaoyuyoung and a lite review from Copilot August 17, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the prompt processing agent to publish an stf_processed ActiveMQ message when PanDA polling completes (or times out), and propagates output dataset context through the polling lifecycle so downstream consumers can associate results with the produced dataset.

Changes:

  • Convert PanDA job IDs to integers before calling getFullJobStatus().
  • Add output_dataset propagation to the PanDA polling scheduler task context and recovery path.
  • Publish an stf_processed message to /topic/epictopic when a polled PanDA task reaches a terminal condition.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agents/prompt_processing_agent.py
@zhaoyuyoung

zhaoyuyoung commented Aug 18, 2026

Copy link
Copy Markdown
Member

I have an overall question about using ActiveMQ. For the downstream consumers, won't it be able to use the swf-monitor endpoint stf-files? All STF status including datasets can be found from the API and may also be queried by clients outside the testbed.

)
)
# Publish stf_processed message to ActiveMQ
self._publish_stf_processed(task, result, timed_out)

@zhaoyuyoung zhaoyuyoung Aug 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result from last poll may not provide the expected numbers, because each poll initializes at line 889, the for last poll processed or failed is 0 if earlier polls have already patched all STF files. The processed/failed in each poll is not the final statistics as reported to swf-monitor.

This is the tail of run 102966 polls:

2026-08-17 15:58:34,205 - INFO - base_agent - PanDA polling updated STF files for run 102966 (task_id=38974, site=E1_BNL, input_dataset=group.daq:run.102966.E1_BNL): processed=1, failed=0, task_status=running, jobs_seen=8, unfinished=0, unmatched=0
INFO: PanDA polling updated STF files for run 102966 (task_id=38975, site=E1_JLAB, input_dataset=group.daq:run.102966.E1_JLAB): processed=1, failed=0, task_status=running, jobs_seen=7, unfinished=0, unmatched=0
2026-08-17 15:58:54,466 - INFO - base_agent - PanDA polling updated STF files for run 102966 (task_id=38975, site=E1_JLAB, input_dataset=group.daq:run.102966.E1_JLAB): processed=1, failed=0, task_status=running, jobs_seen=7, unfinished=0, unmatched=0
INFO: PanDA polling updated STF files for run 102966 (task_id=38974, site=E1_BNL, input_dataset=group.daq:run.102966.E1_BNL): processed=0, failed=0, task_status=done, jobs_seen=8, unfinished=0, unmatched=0
2026-08-17 15:59:34,944 - INFO - base_agent - PanDA polling updated STF files for run 102966 (task_id=38974, site=E1_BNL, input_dataset=group.daq:run.102966.E1_BNL): processed=0, failed=0, task_status=done, jobs_seen=8, unfinished=0, unmatched=0
INFO: PanDA polling updated STF files for run 102966 (task_id=38975, site=E1_JLAB, input_dataset=group.daq:run.102966.E1_JLAB): processed=0, failed=0, task_status=done, jobs_seen=7, unfinished=0, unmatched=0
2026-08-17 15:59:55,655 - INFO - base_agent - PanDA polling updated STF files for run 102966 (task_id=38975, site=E1_JLAB, input_dataset=group.daq:run.102966.E1_JLAB): processed=0, failed=0, task_status=done, jobs_seen=7, unfinished=0, unmatched=0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe downstream can aggregate the processed/failed itself or using swf-monitor API, or we can make processed/failed less ambiguous in the message, e.g. updated_processed/updated_failed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what is the issue. This is triggered when task enters completed state. You had two tasks with 8 and 7 jobs (15 together), this should have reported two messages.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on how the message will be used, I just want to pointed out the message from each poll only gives processed/failed count in that poll, not total and last poll even gives 0. If the downstream only needs task status, that's fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the consumer will need just the status and dataset name. In my tests I got the correct final values, but if you reproduce something else, we can fix that.

@veprbl

veprbl commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

I have an overall question about using ActiveMQ. For the downstream consumers, won't it be able to use the swf-monitor endpoint stf-files? All STF status including datasets can be found from the API and may also be queried by clients outside the testbed.

By that logic we should excise ActiveMQ everywhere. We'd need to first port data-agent and processing-agent to use monitor API polling.

'run_id': task.get("run_number"),
'panda_task_id': task.get("panda_task_id"),
'task_status': result.get("task_status"),
'processed': result.get("processed", 0),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the key might be misleading if one thinks processed is the total. It's actually my fault to name it that way. Its true meaning is updated_processed in each poll.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's a difference, not an absolute value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove this field and add it back once correct accounting is implemented.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove them are also fine if the meaningful field is just task_status. I don't think we should aggregate the total processed/failed in each poll though, otherwise the statistics will be wrong in the monitor. Each poll only tries to update previously unfinished STF status. If need the total statistics, I think stf-files in the monitor is a better method to extract that.

@zhaoyuyoung zhaoyuyoung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added stf_processed is good in terms of codes and as long as the message items are clear for downstream consumers, it's fine to merge.

@zhaoyuyoung

Copy link
Copy Markdown
Member

Hi @veprbl,

I approved this PR. I also tested it in a prompt processing workflow and saw the new stf_processed messages for run 102972. Very nice. Please go ahead to merge is when you think no more changes need to make.
Screenshot 2026-08-18 at 9 19 01 PM

@veprbl
veprbl merged commit 9eb5aa6 into main Aug 25, 2026
3 checks passed
@veprbl
veprbl deleted the pr/stf_processed branch August 25, 2026 16:22
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.

3 participants