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

Profile CLI run through dask #193

Merged
merged 3 commits into from
Oct 22, 2024
Merged

Profile CLI run through dask #193

merged 3 commits into from
Oct 22, 2024

Conversation

gerritholl
Copy link
Member

For the CLI added in #184, add an option to profile the results using dask.diagnostics and visualize the results as a bokeh plot.

  • Tests added
  • Tests passed
  • Passes flake8 trollflow2
  • Fully documented

For the cli tool recently added in pytroll#184, this adds an option to profile
the run via dask and visualise the output as a bokeh plot.
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.96%. Comparing base (e3c255e) to head (98355d9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
+ Coverage   95.93%   95.96%   +0.02%     
==========================================
  Files          14       14              
  Lines        3246     3268      +22     
==========================================
+ Hits         3114     3136      +22     
  Misses        132      132              
Flag Coverage Δ
unittests 95.96% <100.00%> (+0.02%) ⬆️

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.

@gerritholl
Copy link
Member Author

We should merge #184 first.

@djhoese
Copy link
Member

djhoese commented Oct 24, 2023

In polar2grid I think I called this --create-profile and nargs=?. That way I could provide a default HTML file name with info about the reader and writer being used and the current time.

@gerritholl
Copy link
Member Author

In polar2grid I think I called this --create-profile and nargs=?. That way I could provide a default HTML file name with info about the reader and writer being used and the current time.

I don't understand what you mean by "provide a default HTML file name". With nargs=? you'd be giving multiple HTML file names to write to? Info about the reader and writer, you mean by string substitution?

@djhoese
Copy link
Member

djhoese commented Oct 24, 2023

Sorry. With nargs="?" and default=False you can pass only --create-profile to the CLI and args.create_profile will be None (if I remember correctly). Or you can do --create-profile profile_my_filename.html. Or if it isn't specified at all then args.create_profile is False. If it is None I then later set it to "{project_name}_{glue_name}_{start_time:%Y%m%d_%H%M%S}.html" where for P2G project_name is either "geo2grid" or "polar2grid", glue_name is <reader_name>2<writer_name> and start_time is the current time when the script is executed. I also allow the user to specify end_time in the format string.

I turned it into a context manager:

https://github.com/ssec/polar2grid/blob/4c470fa9de54c4b141cf4a5301a90005f35d5c84/polar2grid/glue.py#L241-L266

You'll notice I also print out a file:// version of the HTML path so in my Terminal on linux it is Ctrl + left click-able and opens in my browser.

@pnuu
Copy link
Member

pnuu commented Oct 22, 2024

I merged main to the PR and tried to resolve the conflicts. Lets see what the CI says.

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM

@pnuu pnuu merged commit 1ec3b18 into pytroll:main Oct 22, 2024
9 checks passed
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.

4 participants