Skip to content

Commit

Permalink
feat(back): fluidattacks#973.1 tags support
Browse files Browse the repository at this point in the history
- add tag support for aws jobs
  • Loading branch information
Daniel Murcia committed Oct 24, 2022
1 parent 22c92c3 commit 36eafce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/args/compute-on-aws-batch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
queue,
name,
setup,
tags,
vcpus,
}:
makeScript {
Expand Down Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions src/args/compute-on-aws-batch/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function main {
local name="__argName__"
local queue="__argQueue__"
local parallel="__argParallel__"
local tags="__argTags__"
local submit_job_args

: \
Expand Down Expand Up @@ -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}")
Expand Down
4 changes: 4 additions & 0 deletions src/evaluator/modules/compute-on-aws-batch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,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;
};
Expand Down

0 comments on commit 36eafce

Please sign in to comment.