- 
                Notifications
    
You must be signed in to change notification settings  - Fork 20
 
SFollow #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SFollow #567
Conversation
          Codecov Report❌ Patch coverage is  
 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     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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 | 
There was a problem hiding this 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?
There was a problem hiding this comment.
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` | 
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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
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