riga / law

Build large-scale task workflows: luigi + job submission + remote targets + environment sandboxing using Docker/Singularity
http://law.readthedocs.io
BSD 3-Clause "New" or "Revised" License
98 stars 41 forks source link

Add JobInputFile to improve job input control #120

Closed riga closed 2 years ago

riga commented 2 years ago

This PR introduces law.JobInputFile which is meant to improve control over job input files. It wraps an input file path, as well as three flags:

In the *_job_config hook of workflow tasks, this might look like the following (shown for the HTCondorWorkflow).

class MyTask(..., law.htcondor.HTCondorWorkflow):

    ...

    def htcondor_job_config(self, config, job_num, branches):
        # a normal input file
        config.input_files["file_a"] = "/path/to/file"
        # same as law.JobInputFile("/path/to/file")

        # a file that should not be rendered
        config.input_files["file_b"] = law.JobInputFile("/path/to/archive.tgz", render=False)

        return config

Besides these additions, a couple smaller fixes are included in this PR that resolve some ambiguities that arose during handling of submission-relative and job-relative paths of input files.