Skip to content

Commit

Permalink
Fixup swap order of argname options so we can access report_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed May 1, 2024
1 parent 24a62e7 commit 78c2119
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/duct.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,44 +147,52 @@ def create_and_parse_args():
parser.add_argument("command", help="The command to execute.")
parser.add_argument("arguments", nargs="*", help="Arguments for the command.")
parser.add_argument(
"-p", "--output-prefix",
"-p",
"--output-prefix",
type=str,
default=os.getenv("DUCT_OUTPUT_PREFIX", ".duct/logs/{datetime_filesafe}-{pid}_"),
default=os.getenv(
"DUCT_OUTPUT_PREFIX", ".duct/logs/{datetime_filesafe}-{pid}_"
),
help="File string format to be used as a prefix for the files -- the captured "
"stdout and stderr and the resource usage logs. The understood variables are "
"{datetime}, {datetime_filesafe}, and {pid}. "
"Leading directories will be created if they do not exist. "
"You can also provide value via DUCT_OUTPUT_PREFIX env variable. "
"stdout and stderr and the resource usage logs. The understood variables are "
"{datetime}, {datetime_filesafe}, and {pid}. "
"Leading directories will be created if they do not exist. "
"You can also provide value via DUCT_OUTPUT_PREFIX env variable. ",
)
parser.add_argument(
"--s-i", "--sample-interval",
"--sample-interval",
"--s-i",
type=float,
default=float(os.getenv("DUCT_SAMPLE_INTERVAL", "1.0")),
help="Interval in seconds between status checks of the running process.",
)
parser.add_argument(
"--r-i", "--report-interval",
"--report-interval",
"--r-i",
type=float,
default=float(os.getenv("DUCT_REPORT_INTERVAL", "60.0")),
help="Interval in seconds at which to report aggregated data.",
)
parser.add_argument(
"-c", "--capture-outputs",
"-c",
"--capture-outputs",
type=str,
default=os.getenv("DUCT_CAPTURE_OUTPUTS", "all"),
choices=["all", "none", "stdout", "stderr"],
help="Record stdout, stderr, all, or none to log files. "
"You can also provide value via DUCT_CAPTURE_OUTPUTS env variable."
"You can also provide value via DUCT_CAPTURE_OUTPUTS env variable.",
)
parser.add_argument(
"-o", "--outputs",
"-o",
"--outputs",
type=str,
default="all",
choices=["all", "none", "stdout", "stderr"],
help="Print stdout, stderr, all, or none to stdout/stderr respectively.",
)
parser.add_argument(
"-t", "--record-types",
"-t",
"--record-types",
type=str,
default="all",
choices=["all", "system-summary", "processes-samples"],
Expand Down Expand Up @@ -255,7 +263,7 @@ def monitor_process(
for pid, pinfo in aggregated.items():
with open(
resource_stats_log_path.format(
output_prefix=output_prefix, sep=sep, pid=pid
output_prefix=output_prefix, pid=pid
),
"a",
) as resource_statistics_log:
Expand Down

0 comments on commit 78c2119

Please sign in to comment.