-
Notifications
You must be signed in to change notification settings - Fork 44
feat: add support for REANA #231
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| inputs: | ||
| files: | ||
| - ttbar_analysis_pipeline.py | ||
| - nanoaod_inputs.json | ||
| - cabinetry_config.yml | ||
| - cabinetry_config_ml.yml | ||
| - corrections.json | ||
| directories: | ||
| - histograms | ||
| - utils | ||
| - models | ||
| - reference | ||
| workflow: | ||
| type: serial | ||
| resources: | ||
| dask: | ||
| image: registry.cern.ch/docker.io/alputer/agc-dask:1.0.0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the analysis has Let's tune the parameters such as (And we could recommend "big" settings for the full data processing somewhere in the docs.)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I forgot that
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I scaled down the requested cluster size, but I guess with default settings it is not runnable locally even with Option 1 (Was very slow, at least half an hour execution time even with Option 2 (Workers under a lot of pressure, losing progress and likely to fail) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW here is one data point. Testing on a laptop with 12 CPU cores and 32 GB RAM, using P.S. A further test with 15 workers showed similar time as with 10 workers, which makes perfect sense, because the laptop has only 12 cores. |
||
| number_of_workers: 20 | ||
| single_worker_memory: 2Gi | ||
| single_worker_threads: 1 | ||
| specification: | ||
| steps: | ||
| - name: agc | ||
| environment: registry.cern.ch/docker.io/alputer/agc-dask:1.0.0 | ||
| commands: | ||
| - python3 ttbar_analysis_pipeline.py | ||
| outputs: | ||
| files: | ||
| - histograms.root | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
| - workspace.json | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,13 @@ def get_client(af="coffea_casa"): | |||||||||||||||||||||||||||||||||||||||
| cluster.scale(10) | ||||||||||||||||||||||||||||||||||||||||
| client = cluster.get_client() | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| elif af == "reana": | ||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the new analysis facility necessary? Perhaps not if we do something like: DASK_SCHEDULER_URI = os.getenv("DASK_SCHEDULER_URI", "tcp://127.0.0.1:8080")
client = dask.distributed.Client(DASK_SCHEDULER_URI)I.e. read the environment variable to know where to connect, and if there is none set, then use the Dask defaults? Such a technique could perhaps work for both REANA use case and the local use case. (Untested.) One advantage this would bring is to "teach" researchers how to write Dask code runnable both locally and on REANA from the start.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be difficult to fully generalize the logic: on some facilities we expect to connect to an existing cluster, which may or may not have an addressed stored in an environment variable, but then if we do not find that the right action to take still depends on the facility as the spawning varies as well. I'm open to suggestions though. We could add the logic at the beginning of the function to connect to an existing cluster if the environment variable points to one and ignore the value of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think without introducing a new analysis facility, code will be less intuitive as all different ways to run and connect to Dask clusters are handled in seperate if clauses, and handling REANA and local use cases together will be an exception to that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I thought above only about "local" and "reana", that these two could perhaps be one. (Because the only thing that is different is the URI of the Dask scheduler.) But for the other analysis facilities, and their special spawning, would have to stay apart... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexander-held BTW it would be very nice to make the analysis fully configurable so that people wouldn't have to edit This could be done by two ways, either respecting command-line arguments to the notebook in the papermill style, or reading values from environment variables if they are set. For example: # a) using command-line options
$ python3 ttbar_analysis_pipeline.py --use-inference False
# b) using environment variables
$ USE_INFERENCE=False python3 ttbar_analysis_pipeline.pyWould you be open for such changes to the repository? We could discuss IRL on Friday.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the For the topic of configuring things: yes, that sounds like a good idea to me. There are a few things in the main file analysis-grand-challenge/analyses/cms-open-data-ttbar/ttbar_analysis_pipeline.py Lines 88 to 106 in c37bf59
utils/config.py. We probably do not need to support configuring all of them externally but the performance-related ones would be useful. A CLI feels more pythonic to me than picking up environment variables and would still allow env-based configuration by just feeding those variables in through the CLI. We might need to think a bit about how to integrate this in a way that is not too invasive to keep the notebook / .py synchronization working but I'm sure that we can find a solution there.
|
||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||
| from dask.distributed import Client | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| DASK_SCHEDULER_URI = os.getenv("DASK_SCHEDULER_URI") | ||||||||||||||||||||||||||||||||||||||||
| client = Client(DASK_SCHEDULER_URI) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| elif af == "local": | ||||||||||||||||||||||||||||||||||||||||
| from dask.distributed import Client | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||

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.
A few of the files here aren't technically needed I think, like
nanoad_branch_ratios.json,GetIOBranches.py,jetassignment_training*andmake_corrections_json.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.
Yes, indeed most of the inputs were unnecessary. Updated the inputs list.