fix: reporting remote nodes number#3978
Conversation
johanneskoester
left a comment
There was a problem hiding this comment.
Can't we just say "Provided remote nodes: unlimited"? A bit easier to read since it has the same structure as in the other case.
📝 WalkthroughWalkthroughA logging adjustment in the execute method where remote node counts are now formatted as "unlimited" when nodes equals sys.maxsize, otherwise displaying the numeric value. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@johanneskoester yes. Sure. Then again ... the number of nodes is neither finite nor unlimited. It is rather a number of concurrent jobs, we set or allow with |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/snakemake/workflow.py (1)
1384-1391: Code is correct, but consider using the formatted display value in the event payload for consistency.The
nodes_strternary correctly formats the output as"unlimited"whenself.nodes == sys.maxsize. However, theextra=dict(..., nodes=self.nodes)still passes the raw integer value to the structured log payload, which will be9223372036854775807for unlimited nodes. This inconsistency may confuse downstream log consumers.Optional: use the formatted value in the event payload
- logger.info( - f"Provided remote nodes: {nodes_str}", - extra=dict(event=LogEvent.RESOURCES_INFO, nodes=self.nodes), - ) + logger.info( + f"Provided remote nodes: {nodes_str}", + extra=dict(event=LogEvent.RESOURCES_INFO, nodes=nodes_str), + )Note: This is optional because the current design (numeric value in structured event, formatted string in message) is a valid choice for consumers that need the actual integer value. Only apply this if downstream event consumers expect a human-readable format.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/snakemake/workflow.py` around lines 1384 - 1391, The log message uses nodes_str for the human-readable message but passes the raw self.nodes integer in the structured payload; update the logger call so the extra payload uses the formatted display value (nodes_str) instead of self.nodes to keep message and event payload consistent—locate the logger.info invocation that currently builds nodes_str and change extra=dict(event=LogEvent.RESOURCES_INFO, nodes=self.nodes) to supply nodes=nodes_str (preserving LogEvent.RESOURCES_INFO and the same logger.info call).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/snakemake/workflow.py`:
- Around line 1384-1391: The log message uses nodes_str for the human-readable
message but passes the raw self.nodes integer in the structured payload; update
the logger call so the extra payload uses the formatted display value
(nodes_str) instead of self.nodes to keep message and event payload
consistent—locate the logger.info invocation that currently builds nodes_str and
change extra=dict(event=LogEvent.RESOURCES_INFO, nodes=self.nodes) to supply
nodes=nodes_str (preserving LogEvent.RESOURCES_INFO and the same logger.info
call).
🤖 I have created a release *beep* *boop* --- ## [9.21.1](v9.21.0...v9.21.1) (2026-05-29) ### Bug Fixes * add default json function to benchmarks ([#4128](#4128)) ([41fab22](41fab22)) * do not rerun when checkpoint job missing but downstream file exists ([#4124](#4124)) ([a060b93](a060b93)) * ensure that error logs contain all available details ([#4183](#4183)) ([74a86e9](74a86e9)) * handle missing pss attribute in benchmark on Windows ([#4160](#4160)) ([da52080](da52080)) * implement Resources.setdefault ([#3968](#3968)) ([2413e99](2413e99)) * reporting remote nodes number ([#3978](#3978)) ([8c534f0](8c534f0)) * resolve pathvars before constructing storage queries ([#3969](#3969)) ([bd15237](bd15237)) * storage temp() file cleanup with RemoteProvider ([#4189](#4189)) ([898bad1](898bad1)) * tolerate FileNotFoundError in drop_iocache ([#4153](#4153)) ([#4191](#4191)) ([ce26b28](ce26b28)) ### Documentation * Added guide on debugging workflows ([#4029](#4029)) ([3d052ae](3d052ae)) * **cli:** Remove broken ref bold markup ([#4204](#4204)) ([1200ebf](1200ebf)) * remove duplicated resources attribute in rules.rst ([#4190](#4190)) ([6c8ecdd](6c8ecdd)) * **rules:** Update script type hint advice ([#4193](#4193)) ([6108712](6108712)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
When passing
-j unlimited, workflow.py reportsProvided remote nodes: 9223372036854775807(this number happens to be mysys.maxsize. This is rather confusing. Hence, this PR which in this case just reportsThe number of remote nodes is set to be unlimited.. Hope that is fine. There are no additional tests or documentation setting necessary.Summary by CodeRabbit