Skip to content

Commit 11c2292

Browse files
redesign: move igneous wait to igneous queue wait
1 parent 6b4809b commit 11c2292

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

igneous_cli/cli.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -885,24 +885,6 @@ def _is_empty():
885885

886886
return _is_empty
887887

888-
@main.command()
889-
@click.argument("queue", type=str)
890-
@click.option('--aws-region', default=SQS_REGION_NAME, help=f"AWS region in which the SQS queue resides.", show_default=True)
891-
@click.option('--rate', default=30.0, help=f"Number of seconds between each poll of the queue.", show_default=True)
892-
@click.pass_context
893-
def wait(ctx, queue, aws_region, rate):
894-
"""Wait for a queue to empty without executing tasks.
895-
896-
This can be useful for filling a queue and then waiting
897-
for a cluster to finish processing before loading the next
898-
set of tasks in a script.
899-
"""
900-
tq = TaskQueue(normalize_path(queue), region_name=aws_region)
901-
empty_fn = is_empty(tq)
902-
903-
while not empty_fn():
904-
time.sleep(rate)
905-
906888
@main.command()
907889
@click.argument("queue", type=str)
908890
@click.option('--aws-region', default=SQS_REGION_NAME, help=f"AWS region in which the SQS queue resides.", show_default=True)
@@ -1969,13 +1951,30 @@ def queuegroup():
19691951
"""
19701952
pass
19711953

1954+
@queuegroup.command()
1955+
@click.argument("queue", type=str)
1956+
@click.option('--aws-region', default=SQS_REGION_NAME, help=f"AWS region in which the SQS queue resides.", show_default=True)
1957+
@click.option('--rate', default=30.0, help=f"Number of seconds between each poll of the queue.", show_default=True)
1958+
@click.pass_context
1959+
def wait(ctx, queue, aws_region, rate):
1960+
"""Wait for a queue to empty without executing tasks.
1961+
1962+
This can be useful for filling a queue and then waiting
1963+
for a cluster to finish processing before loading the next
1964+
set of tasks in a script.
1965+
"""
1966+
tq = TaskQueue(normalize_path(queue), region_name=aws_region)
1967+
empty_fn = is_empty(tq)
1968+
1969+
while not empty_fn():
1970+
time.sleep(rate)
1971+
19721972
@queuegroup.command()
19731973
@click.argument("path")
19741974
def rezero(path):
19751975
"""Reset collected statistics for queue."""
19761976
TaskQueue(normalize_path(path)).rezero()
19771977

1978-
19791978
def natural_time_delta(seconds:float) -> str:
19801979
sec = abs(seconds)
19811980
if sec == 0.0:

0 commit comments

Comments
 (0)