diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/delivery_test.c | 3 | ||||
| -rw-r--r-- | src/globals.c | 1 | ||||
| -rw-r--r-- | src/stasis_main.c | 13 | 
3 files changed, 17 insertions, 0 deletions
| diff --git a/src/delivery_test.c b/src/delivery_test.c index 3809768..d79e088 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -25,18 +25,21 @@ void delivery_tests_run(struct Delivery *ctx) {              perror("mp_pool_init/parallel");              exit(1);          } +        pool[PARALLEL]->status_interval = globals.pool_status_interval;          pool[SERIAL] = mp_pool_init("serial", ctx->storage.tmpdir);          if (!pool[SERIAL]) {              perror("mp_pool_init/serial");              exit(1);          } +        pool[SERIAL]->status_interval = globals.pool_status_interval;          pool[SETUP] = mp_pool_init("setup", ctx->storage.tmpdir);          if (!pool[SETUP]) {              perror("mp_pool_init/setup");              exit(1);          } +        pool[SETUP]->status_interval = globals.pool_status_interval;          // Test block scripts shall exit non-zero on error.          // This will fail a test block immediately if "string" is not found in file.txt: diff --git a/src/globals.c b/src/globals.c index 667809b..b93566a 100644 --- a/src/globals.c +++ b/src/globals.c @@ -39,6 +39,7 @@ struct STASIS_GLOBAL globals = {          .enable_testing = true, ///< Toggle [test] block "script" execution. "script_setup" always executes.          .enable_rewrite_spec_stage_2 = true, ///< Leave template stings in output files          .parallel_fail_fast = false, ///< Kill ALL multiprocessing tasks immediately on error +        .pool_status_interval = 30, ///< Report "Task is running"  };  void globals_free() { diff --git a/src/stasis_main.c b/src/stasis_main.c index da050f2..8f14e5f 100644 --- a/src/stasis_main.c +++ b/src/stasis_main.c @@ -13,12 +13,14 @@  #define OPT_OVERWRITE 1005  #define OPT_NO_REWRITE_SPEC_STAGE_2 1006  #define OPT_PARALLEL_FAIL_FAST 1007 +#define OPT_POOL_STATUS_INTERVAL 1009  static struct option long_options[] = {          {"help", no_argument, 0, 'h'},          {"version", no_argument, 0, 'V'},          {"continue-on-error", no_argument, 0, 'C'},          {"config", required_argument, 0, 'c'},          {"cpu-limit", required_argument, 0, 'l'}, +        {"pool-status-interval", required_argument, 0, OPT_POOL_STATUS_INTERVAL},          {"python", required_argument, 0, 'p'},          {"verbose", no_argument, 0, 'v'},          {"unbuffered", no_argument, 0, 'U'}, @@ -39,6 +41,7 @@ const char *long_options_help[] = {          "Allow tests to fail",          "Read configuration file",          "Number of processes to spawn concurrently (default: cpus - 1)", +        "Report task status every n seconds (default: 30)",          "Override version of Python in configuration",          "Increase output verbosity",          "Disable line buffering", @@ -262,6 +265,16 @@ int main(int argc, char *argv[]) {              case OPT_PARALLEL_FAIL_FAST:                  globals.parallel_fail_fast = true;                  break; +            case OPT_POOL_STATUS_INTERVAL: +                globals.pool_status_interval = (int) strtol(optarg, NULL, 10); +                if (globals.pool_status_interval < 1) { +                    globals.pool_status_interval = 1; +                } else if (globals.pool_status_interval > 60 * 10) { +                    // Possible poor choice alert +                    fprintf(stderr, "Caution: Excessive pausing between status updates may cause third-party CI/CD" +                                    " jobs to fail if the stdout/stderr streams are idle for too long!\n"); +                } +                break;              case 'U':                  setenv("PYTHONUNBUFFERED", "1", 1);                  fflush(stdout); | 
