Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential fix for #463 #480

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion looper/cli_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,15 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None):
exclusion_flag=subcommand_args.exc_flag,
) as prj:
if subcommand_name in ["run", "rerun"]:
rerun = subcommand_name == "rerun"
run = Runner(prj)
try:
# compute_kwargs = _proc_resources_spec(args)
compute_kwargs = _proc_resources_spec(subcommand_args)

# TODO Shouldn't top level args and subcommand args be accessible on the same object?
return run(
subcommand_args, top_level_args=args, rerun=False, **compute_kwargs
subcommand_args, top_level_args=args, rerun=rerun, **compute_kwargs
)
except SampleFailedException:
sys.exit(1)
Expand Down
5 changes: 3 additions & 2 deletions looper/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def add_sample(self, sample, rerun=False):
if sample_statuses:
status_str = ", ".join(sample_statuses)
failed_flag = any("failed" in x for x in sample_statuses)
waiting_flag = any("waiting" in x for x in sample_statuses)
if self.ignore_flags:
msg = f"> Found existing status: {status_str}. Ignoring."
else: # this pipeline already has a status
Expand All @@ -318,11 +319,11 @@ def add_sample(self, sample, rerun=False):
use_this_sample = False
if rerun:
# Rescue the sample if rerun requested, and failed flag is found
if failed_flag:
if failed_flag or waiting_flag:
msg = f"> Re-running failed sample. Status: {status_str}"
use_this_sample = True
else:
msg = f"> Skipping sample because rerun requested, but no failed flag found. Status: {status_str}"
msg = f"> Skipping sample because rerun requested, but no failed or waiting flag found. Status: {status_str}"
use_this_sample = False
if msg:
_LOGGER.info(msg)
Expand Down
19 changes: 19 additions & 0 deletions tests/smoketests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ def test_pipestat_configured(self, prep_temp_pep_pipestat, cmd):
raise pytest.fail("DID RAISE {0}".format(Exception))


class TestLooperRerun:
@pytest.mark.parametrize(
"flags", [FLAGS[2], FLAGS[3]]
) # Waiting and Failed flags should work
@pytest.mark.parametrize("pipeline_name", ["example_pipestat_pipeline"])
def test_pipestat_rerun(self, prep_temp_pep_pipestat, pipeline_name, flags):
"""Verify that rerun works with either failed or waiting flags"""
tp = prep_temp_pep_pipestat
_make_flags(tp, flags, pipeline_name)

x = ["rerun", "--looper-config", tp]
try:
result = main(test_args=x)
except Exception:
raise pytest.fail("DID RAISE {0}".format(Exception))

assert result["Jobs submitted"] == 2


class TestLooperCheck:
@pytest.mark.parametrize("flag_id", FLAGS)
@pytest.mark.parametrize(
Expand Down
Loading