Skip to content

Ploughshare download#127

Open
andrpie wants to merge 14 commits intomainfrom
add_download_ploughshare
Open

Ploughshare download#127
andrpie wants to merge 14 commits intomainfrom
add_download_ploughshare

Conversation

@andrpie
Copy link
Copy Markdown

@andrpie andrpie commented Apr 14, 2026

Addresses #102 and NNPDF/pinecards#192.

This is the initial implementation of the class Plough that downloads the grids from ploughshare and converts them into pineappl format (or does whatever is necessary: cutting bins, renaming grids etc.)

Pinecard structure:

The folder would contain two files: ploughshare_link.txt and process_grids.sh (optionally postrun.sh and metadata.txt). Please have a look at the CMS_2JET_8TEV_3D example.
ploughshare_link.txt: contains the link to the file that has to be downloaded
process_grids.sh: responsible for conversion etc.

Class structure

Plough.run(): downloads the (tarball) file and extracts it in the output folder
Plough.generate_pineappl(): runs the process_grids.sh script inside the output folder (also tells it the grid names)

These methods are run when the class is initialised. If they were run conventionally (i.e. by run.py), then an external-pineappl comparison would have to be made at the pinefarm level - this is already done by pineappl import. Also, lines 194-200 of run.py assume that only one grid was generated.

The conversion happens inside process_grids.sh instead of postrun.sh, as postrun.sh only assumes that one grid was generated.

@andrpie andrpie requested review from achiefa and scarlehoff April 14, 2026 16:46
Copy link
Copy Markdown
Contributor

@felixhekhorn felixhekhorn left a comment

Choose a reason for hiding this comment

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

Please also run pre-commit.

Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
andrpie and others added 9 commits April 17, 2026 10:13
Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

I agree with @felixhekhorn the run should be its own run

def subcommand(pinecard, theory_path, pdf, dry, finalize=None):

pinefarm will then run run and generate_pineappl (you can make generate_pineappl do nothing and put everything in a postrun.sh script that will be run as part of the postprocess method:

def postprocess(self):

which just runs postrun.sh and, importantly, burns in the metadata.txt into all grids which we want in general.

Comment thread src/pinefarm/external/plough.py
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
@andrpie
Copy link
Copy Markdown
Author

andrpie commented Apr 28, 2026

Now Plough is compatible with postrun.sh and its run is not called in __init__. I've added a condition in run.py to make it work. The pinecard structure got updated accordingly. Thanks for the suggestions!

Comment thread src/pinefarm/cli/run.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

Thanks!

Left a lot of nitpicks but seems to work (I tested CMS_2JET_8TEV_3D although I could not get grids because of Error: you need to install pineappl with feature fastnlo, which I won't; but I trust it would)

Comment thread src/pinefarm/external/interface.py Outdated
Comment thread src/pinefarm/external/interface.py Outdated
Comment thread src/pinefarm/external/interface.py Outdated
Comment thread src/pinefarm/external/plough.py
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Comment thread src/pinefarm/external/plough.py Outdated
Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Once @felixhekhorn has time for a second look we can merge I think

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.

3 participants