diff --git a/src/args/compute-on-aws-batch/default.nix b/src/args/compute-on-aws-batch/default.nix index db3b9556..29624506 100644 --- a/src/args/compute-on-aws-batch/default.nix +++ b/src/args/compute-on-aws-batch/default.nix @@ -19,6 +19,7 @@ queue, name, setup, + tags, vcpus, }: makeScript { @@ -65,6 +66,13 @@ makeScript { __argName__ = name; __argParallel__ = parallel; __argQueue__ = queue; + __argTags__ = let + tag_names = builtins.attrNames tags; + encode_tag = key: "${key}=${tags."${key}"}"; + encoded = map encode_tag tag_names; + encoded_tags = builtins.concatStringsSep "," encoded; + in + encoded_tags; }; searchPaths = { bin = [ diff --git a/src/args/compute-on-aws-batch/entrypoint.sh b/src/args/compute-on-aws-batch/entrypoint.sh index 036b2e78..3135ea6b 100644 --- a/src/args/compute-on-aws-batch/entrypoint.sh +++ b/src/args/compute-on-aws-batch/entrypoint.sh @@ -22,6 +22,7 @@ function main { local name="__argName__" local queue="__argQueue__" local parallel="__argParallel__" + local tags="__argTags__" local submit_job_args : \ @@ -76,6 +77,7 @@ function main { --job-definition "${definition}" --retry-strategy "attempts=${attempts}" --timeout "attemptDurationSeconds=${attempt_duration_seconds}" + --tags "${tags}" ) \ && if [ "${parallel}" -gt "1" ]; then submit_job_args+=(--array-properties "size=${parallel}") diff --git a/src/evaluator/modules/compute-on-aws-batch/default.nix b/src/evaluator/modules/compute-on-aws-batch/default.nix index 6f3de09f..0002b7d0 100644 --- a/src/evaluator/modules/compute-on-aws-batch/default.nix +++ b/src/evaluator/modules/compute-on-aws-batch/default.nix @@ -25,6 +25,7 @@ inherit (config) parallel; inherit (config) queue; inherit (config) setup; + inherit (config) tags; inherit (config) vcpus; }; }; @@ -73,6 +74,10 @@ in { default = []; type = lib.types.listOf lib.types.package; }; + tags = lib.mkOption { + default = {}; + type = lib.types.attrsOf lib.types.str; + }; vcpus = lib.mkOption { type = lib.types.ints.positive; };