Skip to content

Commit

Permalink
Merge pull request #140 from sesam-community/IS-15927
Browse files Browse the repository at this point in the history
IS-15927: Added a '-scheduler-dont-reset-pipes-or-delete-sink-datasets' commandline option
  • Loading branch information
knutj42 authored Sep 25, 2023
2 parents aea54e9 + 8cc04e6 commit 10cf4f8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion sesam.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from connector_cli import api_key_login, connectorpy, oauth2login, tripletexlogin
from jsonformat import FormatStyle, format_object

sesam_version = "2.8.0"
sesam_version = "2.8.1"

logger = logging.getLogger("sesam")
LOGLEVEL_TRACE = 2
Expand Down Expand Up @@ -508,6 +508,7 @@ def run_internal_scheduler(
max_run_time=None,
max_runs=None,
delete_input_datasets=True,
reset_pipes_and_delete_sink_datasets=None,
check_input_pipes=False,
output_run_statistics=False,
scheduler_mode=None,
Expand All @@ -533,6 +534,9 @@ def run_internal_scheduler(
if check_input_pipes is True:
params["check_input_pipes"] = True

if reset_pipes_and_delete_sink_datasets is False:
params["reset_pipes_and_delete_sink_datasets"] = reset_pipes_and_delete_sink_datasets

if output_run_statistics is True:
params["output_run_statistics"] = True

Expand Down Expand Up @@ -2544,6 +2548,8 @@ def run_internal_scheduler(self):
output_run_statistics = self.args.output_run_statistics
scheduler_mode = self.args.scheduler_mode
requests_mode = self.args.scheduler_request_mode
reset_pipes_and_delete_sink_datasets =\
self.args.scheduler_dont_reset_pipes_or_delete_sink_datasets is not True

if scheduler_mode is not None and scheduler_mode not in ["active", "poll"]:
raise RuntimeError("'scheduler_mode' can only be set to 'active' or 'poll'")
Expand Down Expand Up @@ -2571,6 +2577,7 @@ def run(self):
output_run_statistics=output_run_statistics,
scheduler_mode=scheduler_mode,
request_mode=requests_mode,
reset_pipes_and_delete_sink_datasets=reset_pipes_and_delete_sink_datasets,
)

if requests_mode == "sync":
Expand Down Expand Up @@ -3144,6 +3151,15 @@ def format(self, record):
help="controls whether failing input pipes should make the scheduler run fail",
)

parser.add_argument(
"-scheduler-dont-reset-pipes-or-delete-sink-datasets",
dest="scheduler_dont_reset_pipes_or_delete_sink_datasets",
required=False,
default=False,
action="store_true",
help="controls whether the scheduler should reset any pipes or delete their sink-datasets",
)

parser.add_argument(
"-restart-timeout",
dest="restart_timeout",
Expand Down

0 comments on commit 10cf4f8

Please sign in to comment.