Adding resourceLabels per project and sampe from a config file

This is a potential way to solve the problem: “I want to do cost tracking, e.g., in AWS per sample and project for a pipeline where resourceLabels are not added directly in the module(s).”

You can achieve this by adding the following to your config file:

process {
    resourceLabels = {[
            'project': params.project_name,
            'sample': (meta?.id ?: 'no-sample-info')
        ]}
}

This assumes that your pipeline has a parameter called project_name (that is always available) and that the processes that you want to track per sample have an input called meta with the field id from which you can get the sample name.

This will add project and sample as tags to the associated resource in, e.g., AWS, which allows you to track the costs of the run(s).

This topic was originally brought up and discussed here.

1 Like