From 212e56f1256b8ff3e9dacb0b867e48fcb9d2a315 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 11 Nov 2025 15:52:55 -0500 Subject: Add --no-task-logging CLI argument --- src/cli/stasis/args.c | 2 ++ src/cli/stasis/include/args.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/args.c b/src/cli/stasis/args.c index f3ce823..fbda494 100644 --- a/src/cli/stasis/args.c +++ b/src/cli/stasis/args.c @@ -20,6 +20,7 @@ struct option long_options[] = { {"no-artifactory-upload", no_argument, 0, OPT_NO_ARTIFACTORY_UPLOAD}, {"no-testing", no_argument, 0, OPT_NO_TESTING}, {"no-parallel", no_argument, 0, OPT_NO_PARALLEL}, + {"no-task-logging", no_argument, 0, OPT_NO_TASK_LOGGING}, {"no-rewrite", no_argument, 0, OPT_NO_REWRITE_SPEC_STAGE_2}, {0, 0, 0, 0}, }; @@ -43,6 +44,7 @@ const char *long_options_help[] = { "Do not upload artifacts to Artifactory (dry-run)", "Do not execute test scripts", "Do not execute tests in parallel", + "Do not log task output (write to stdout)", "Do not rewrite paths and URLs in output files", NULL, }; diff --git a/src/cli/stasis/include/args.h b/src/cli/stasis/include/args.h index 5bad752..850be4a 100644 --- a/src/cli/stasis/include/args.h +++ b/src/cli/stasis/include/args.h @@ -17,6 +17,7 @@ #define OPT_FAIL_FAST 1009 #define OPT_NO_PARALLEL 1010 #define OPT_POOL_STATUS_INTERVAL 1011 +#define OPT_NO_TASK_LOGGING 1012 extern struct option long_options[]; void usage(char *progname); -- cgit From 36964de6ce26241e40693509efeefa613bc49a28 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 11 Nov 2025 15:53:14 -0500 Subject: Integrate --no-task-logging CLI argument --- src/cli/stasis/stasis_main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index 2ce6831..967ecaf 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -586,6 +586,9 @@ int main(int argc, char *argv[]) { case OPT_NO_PARALLEL: globals.enable_parallel = false; break; + case OPT_NO_TASK_LOGGING: + globals.enable_task_logging = false; + break; case '?': default: exit(1); -- cgit From 18b29bd58d1daa1752e981488445e0fcb100f2a7 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 30 Dec 2025 11:28:36 -0500 Subject: Implement task timeout * Add argument: --task-timeout=1[s,m,h] * Timed out tasks are SIGKILL'd * If killing a task fails, the entire program ends --- src/cli/stasis/args.c | 28 ++++++++++++++++++++++++++++ src/cli/stasis/include/args.h | 5 +++++ src/cli/stasis/stasis_main.c | 12 ++++++++++++ 3 files changed, 45 insertions(+) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/args.c b/src/cli/stasis/args.c index fbda494..9410958 100644 --- a/src/cli/stasis/args.c +++ b/src/cli/stasis/args.c @@ -13,6 +13,7 @@ struct option long_options[] = { {"unbuffered", no_argument, 0, 'U'}, {"update-base", no_argument, 0, OPT_ALWAYS_UPDATE_BASE}, {"fail-fast", no_argument, 0, OPT_FAIL_FAST}, + {"task-timeout", required_argument, 0, OPT_TASK_TIMEOUT}, {"overwrite", no_argument, 0, OPT_OVERWRITE}, {"no-docker", no_argument, 0, OPT_NO_DOCKER}, {"no-artifactory", no_argument, 0, OPT_NO_ARTIFACTORY}, @@ -37,6 +38,7 @@ const char *long_options_help[] = { "Disable line buffering", "Update conda installation prior to STASIS environment creation", "On error, immediately terminate all tasks", + "Terminate task after timeout is reached (#s, #m, #h)", "Overwrite an existing release", "Do not build docker images", "Do not upload artifacts to Artifactory", @@ -104,3 +106,29 @@ void usage(char *progname) { puts(output); } } + +int str_to_timeout(char *s) { + if (!s) { + return 0; // no timeout + } + + char *scale = NULL; + int value = (int) strtol(s, &scale, 10); + if (scale) { + if (*scale == 's') { + value *= 1; // seconds, no-op + } else if (*scale == 'm') { + value *= 60; // minutes + } else if (*scale == 'h') { + value *= 3200; // hours + } else { + return STR_TO_TIMEOUT_INVALID_TIME_SCALE; // invalid time scale + } + } + + if (value < 0) { + return STR_TO_TIMEOUT_NEGATIVE; // cannot be negative + } + return value; +} + diff --git a/src/cli/stasis/include/args.h b/src/cli/stasis/include/args.h index 850be4a..d75fe29 100644 --- a/src/cli/stasis/include/args.h +++ b/src/cli/stasis/include/args.h @@ -18,8 +18,13 @@ #define OPT_NO_PARALLEL 1010 #define OPT_POOL_STATUS_INTERVAL 1011 #define OPT_NO_TASK_LOGGING 1012 +#define OPT_TASK_TIMEOUT 1013 extern struct option long_options[]; void usage(char *progname); +#define STR_TO_TIMEOUT_NEGATIVE (-1) +#define STR_TO_TIMEOUT_INVALID_TIME_SCALE (-2) +int str_to_timeout(char *s); + #endif //STASIS_ARGS_H diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index 967ecaf..44ee6d7 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -540,6 +540,18 @@ int main(int argc, char *argv[]) { case OPT_FAIL_FAST: globals.parallel_fail_fast = true; break; + case OPT_TASK_TIMEOUT: + globals.task_timeout = str_to_timeout(optarg); + if (globals.task_timeout < 0) { + fprintf(stderr, "Invalid timeout: %s\n", optarg); + if (globals.task_timeout == STR_TO_TIMEOUT_INVALID_TIME_SCALE) { + fprintf(stderr, "Use format '#s' (seconds), '#m' (minutes), '#h' (hours)\n"); + } else if (globals.task_timeout == STR_TO_TIMEOUT_NEGATIVE) { + fprintf(stderr, "Timeout cannot be negative\n"); + } + exit(1); + } + break; case OPT_POOL_STATUS_INTERVAL: globals.pool_status_interval = (int) strtol(optarg, NULL, 10); if (globals.pool_status_interval < 1) { -- cgit From 9be1567765803341e252e87262dc43d790d8e770 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 2 Jan 2026 16:23:28 -0500 Subject: Move utility functions to utils.c --- src/cli/stasis/args.c | 26 -------------------------- src/cli/stasis/include/args.h | 4 ---- 2 files changed, 30 deletions(-) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/args.c b/src/cli/stasis/args.c index 9410958..172981a 100644 --- a/src/cli/stasis/args.c +++ b/src/cli/stasis/args.c @@ -106,29 +106,3 @@ void usage(char *progname) { puts(output); } } - -int str_to_timeout(char *s) { - if (!s) { - return 0; // no timeout - } - - char *scale = NULL; - int value = (int) strtol(s, &scale, 10); - if (scale) { - if (*scale == 's') { - value *= 1; // seconds, no-op - } else if (*scale == 'm') { - value *= 60; // minutes - } else if (*scale == 'h') { - value *= 3200; // hours - } else { - return STR_TO_TIMEOUT_INVALID_TIME_SCALE; // invalid time scale - } - } - - if (value < 0) { - return STR_TO_TIMEOUT_NEGATIVE; // cannot be negative - } - return value; -} - diff --git a/src/cli/stasis/include/args.h b/src/cli/stasis/include/args.h index d75fe29..5536735 100644 --- a/src/cli/stasis/include/args.h +++ b/src/cli/stasis/include/args.h @@ -23,8 +23,4 @@ extern struct option long_options[]; void usage(char *progname); -#define STR_TO_TIMEOUT_NEGATIVE (-1) -#define STR_TO_TIMEOUT_INVALID_TIME_SCALE (-2) -int str_to_timeout(char *s); - #endif //STASIS_ARGS_H -- cgit