Skip to content
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

Cleanup cli #536

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Cleanup cli #536

wants to merge 8 commits into from

Conversation

BenGalewsky
Copy link
Contributor

@BenGalewsky BenGalewsky commented Dec 17, 2024

This pull request introduces several new features and improvements to the ServiceX CLI. The most notable changes include the addition of new commands, enhancements to the output formatting, and the implementation of new functionalities for managing transforms. Also completed the unit tests for the CLI code. Below is a summary of the most important changes:

New CLI Commands

  • Added deliver command to submit a YAML configuration file to the ServiceX backend and print the resulting file paths. (docs/command_line.rst, servicex/app/main.py) [1] [2]
  • Added cancel command to cancel a running transform. (docs/command_line.rst, servicex/app/transforms.py) [1] [2]

Output Formatting Enhancements

  • Introduced pipeable_table function to create tables that adapt based on the output destination (terminal or pipe). Applied this function to various commands to improve output formatting. (servicex/app/__init__.py, servicex/app/cache.py, servicex/app/datasets.py, servicex/app/transforms.py) [1] [2] [3] [4]

Transform Management Improvements

  • Implemented cancel_transform method in ServiceXClient and ServiceXAdapter to support the new cancel command. (servicex/servicex_adapter.py, servicex/servicex_client.py) [1] [2]

Configuration File Support

  • Added support for specifying a configuration file path (config_path) in various commands to allow more flexible configuration management. (servicex/app/datasets.py, servicex/app/transforms.py) [1] [2]

Tests

  • Added tests for the new deliver command and version output. (tests/app/test_app.py)
  • The local cache delete operation as part of transform delete was very hard to test as it was written. Moved the cache delete code into the ServiceX client and updated the CLI commands. (servicex/app/cache.py, servicex/servicex_client.py) [1] [2]

Ignore Local Cache

  • Added argument to deliver function to force IgnoreLocalCache setting. Accessible from the CLI too

The app commands use the Rich.Table to make pretty tables as the output
from various commands. This makes it impossible to use unix tools
to perform tasks, such as getting a list of all of the transform ids to
perform a batch delete of all transforms.

Add a switch to the table construction to drop formatting if not a tty.

The datasets get command outputs nested data, so that becomes a json document.
Now all of the CLI has unit tests. Migrated the existing tests to different
scripts in a new tests/app module.

The way cache delete was handled after deleting the transform from the server made it
hard to write a meaningful test. Migrated that code to teh servicex_client class and added
a test there.
Test ocassionally fail due to google auth library reporting
google.auth.exceptions.MalformedError. The test token we were using
really didn't look like a jwt. Picked up a random test JWT to
pass into the library call during tests.
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 84.53608% with 15 lines in your changes missing coverage. Please review.

Project coverage is 92.25%. Comparing base (d329059) to head (f6f563d).

Files with missing lines Patch % Lines
servicex/app/datasets.py 61.53% 10 Missing ⚠️
servicex/servicex_client.py 78.57% 3 Missing ⚠️
servicex/app/cache.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #536      +/-   ##
==========================================
+ Coverage   87.70%   92.25%   +4.55%     
==========================================
  Files          26       27       +1     
  Lines        1683     1744      +61     
==========================================
+ Hits         1476     1609     +133     
+ Misses        207      135      -72     
Flag Coverage Δ
unittests 92.25% <84.53%> (+4.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.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine to have a ServiceXSpec-wide ignore local cache flag. I see how you use that parameter in other places but would it be okay to set it up as a part of ServiceXSpec? E.g. General.IgnoreLocalCache?

Copy link
Contributor

@kyungeonchoi kyungeonchoi left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the nice PR! It looks great. I have one comment :)

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