Skip to content

Conversation

@thomas-robinson
Copy link
Member

@thomas-robinson thomas-robinson commented Aug 1, 2025

Describe your changes

Adds capability to follow standard output of a running slurm job with the slurm jobID.

Issue ticket number and link (if applicable)

Checklist before requesting a review

  • I ran my code
  • I tried to make my code readable
  • I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback
  • No print statements; all user-facing info uses logging module

@thomas-robinson thomas-robinson marked this pull request as draft August 1, 2025 13:47
@codecov
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 98.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.20%. Comparing base (da3b86f) to head (774c7d3).
⚠️ Report is 784 commits behind head on main.

Files with missing lines Patch % Lines
fre/sfollow/fresfollow.py 96.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #567      +/-   ##
==========================================
+ Coverage   68.65%   69.20%   +0.55%     
==========================================
  Files          63       65       +2     
  Lines        4285     4365      +80     
==========================================
+ Hits         2942     3021      +79     
- Misses       1343     1344       +1     
Flag Coverage Δ
unittests 69.20% <98.75%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilaflott ilaflott requested a review from Copilot August 1, 2025 17:53

This comment was marked as outdated.

@thomas-robinson thomas-robinson requested a review from Copilot August 1, 2025 18:00
Copy link
Contributor

Copilot AI left a comment

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 adds the "SFollow" capability to monitor SLURM job output in real-time using the job ID. The module provides functionality to query job information, extract the standard output file path, and follow it using less +F.

Key changes:

  • Implements core sfollow functionality for following SLURM job output files
  • Adds Click CLI interface for user interaction with validation options
  • Integrates the new module into the main FRE CLI framework

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fre/sfollow/sfollow.py Core module implementing SLURM job querying and file following functionality
fre/sfollow/fresfollow.py Click CLI interface for the sfollow command with validation options
fre/sfollow/tests/test_sfollow.py Comprehensive unit tests for core sfollow functionality
fre/sfollow/tests/test_fresfollow.py Unit tests for the CLI interface
fre/sfollow/init.py Module initialization file
fre/sfollow/tests/init.py Test package initialization
fre/sfollow/README.md Documentation for the sfollow module
fre/fre.py Integration of sfollow command into main FRE CLI
coveragerc Updated to exclude sfollow tests from coverage

@thomas-robinson thomas-robinson marked this pull request as ready for review August 4, 2025 11:42
@ilaflott ilaflott self-requested a review August 4, 2025 18:32
Copy link
Member

@ilaflott ilaflott left a comment

Choose a reason for hiding this comment

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

this is interesting but... isn't this kind of redundant with the cylc universe?

Copy link
Member

Choose a reason for hiding this comment

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

some of this is not needed, like the module structure. or the listed dependencies that all come from the python standard library.


## Core Functions

### `get_job_info(job_id: str) -> str`
Copy link
Member

Choose a reason for hiding this comment

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

this is bordering more on content worthy of the docs/*rst files

Copy link
Member

Choose a reason for hiding this comment

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

generally prefer raise to sys.exit, if possible. also, this is generally more logic than in most of the click cli entry points. internalizing it to the function call directly would be better.

Copy link
Member

@ilaflott ilaflott left a comment

Choose a reason for hiding this comment

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

i targeted a job that wasn't mine, is this expected in that case? the codec error is probably fixable.

(fre-cli) an201: ~ $] fre sfollow 48091155
Traceback (most recent call last):
  File "/home/Ian.Laflotte/conda/envs/fre-cli/bin/fre", line 7, in <module>
    sys.exit(fre())
             ^^^^^
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Ian.Laflotte/Working/fre-cli/fre/sfollow/fresfollow.py", line 63, in sfollow_cli
    click.echo(f"\u2717 {message}")
  File "/home/Ian.Laflotte/conda/envs/fre-cli/lib/python3.11/site-packages/click/utils.py", line 318, in echo
    file.write(out)  # type: ignore
    ^^^^^^^^^^^^^^^
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2717' in position 0: ordinal not in range(256)
(fre-cli) an201: ~ $] fre sfollow 48091155 -v

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.

2 participants