File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ def load_task(
379379 remove : bool = True ,
380380 user : Optional [str ] = None ,
381381 custom_image : Optional [str ] = None ,
382- interactive : Optional [bool ] = True ,
382+ interactive : Optional [bool ] = False ,
383383) -> int :
384384 """Load and run a task interactively in a Docker container.
385385
@@ -396,7 +396,7 @@ def load_task(
396396 custom_image: A custom image to use instead of the task's image.
397397 interactive: If True, execution of the task will be paused and user
398398 will be dropped into a shell. They can run `exec-task` to resume
399- it (default: True ).
399+ it (default: False ).
400400
401401 Returns:
402402 int: The exit code from the Docker container.
Original file line number Diff line number Diff line change @@ -679,6 +679,16 @@ def image_digest(args):
679679 help = "The task id or definition to load into a docker container. Can use "
680680 "'-' to read from stdin." ,
681681)
682+ @argument (
683+ "-i" ,
684+ "--interactive" ,
685+ action = "store_true" ,
686+ default = False ,
687+ help = "Setup the task but pause execution before executing its command. "
688+ "Repositories will be cloned, environment variables will be set and an"
689+ "executable script named `exec-task` will be provided to resume task "
690+ "execution. Only supported for `run-task` based tasks." ,
691+ )
682692@argument (
683693 "--keep" ,
684694 dest = "remove" ,
@@ -719,6 +729,7 @@ def load_task(args):
719729 return load_task (
720730 graph_config ,
721731 args ["task" ],
732+ interactive = args ["interactive" ],
722733 remove = args ["remove" ],
723734 user = args ["user" ],
724735 custom_image = args ["image" ],
Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ def inner(args, stdin_data=None):
444444
445445
446446def test_load_task_command (run_load_task ):
447- # Test normal task ID
447+ # Test normal task ID (default non-interactive)
448448 result , mocks = run_load_task (["load-task" , "task-id-123" ])
449449
450450 assert result == 0
@@ -453,6 +453,20 @@ def test_load_task_command(run_load_task):
453453 mocks ["docker_load_task" ].assert_called_once_with (
454454 mocks ["graph_config" ],
455455 "task-id-123" ,
456+ interactive = False ,
457+ remove = True ,
458+ user = None ,
459+ custom_image = None ,
460+ )
461+
462+ # Test with interactive flag
463+ result , mocks = run_load_task (["load-task" , "-i" , "task-id-456" ])
464+
465+ assert result == 0
466+ mocks ["docker_load_task" ].assert_called_once_with (
467+ mocks ["graph_config" ],
468+ "task-id-456" ,
469+ interactive = True ,
456470 remove = True ,
457471 user = None ,
458472 custom_image = None ,
@@ -476,6 +490,7 @@ def test_load_task_command_with_stdin(run_load_task):
476490 mocks ["docker_load_task" ].assert_called_once_with (
477491 mocks ["graph_config" ],
478492 task_def ,
493+ interactive = False ,
479494 remove = True ,
480495 user = None ,
481496 custom_image = None ,
@@ -492,6 +507,7 @@ def test_load_task_command_with_task_id(run_load_task):
492507 mocks ["docker_load_task" ].assert_called_once_with (
493508 mocks ["graph_config" ],
494509 "task-id-from-stdin" ,
510+ interactive = False ,
495511 remove = True ,
496512 user = None ,
497513 custom_image = None ,
You can’t perform that action at this time.
0 commit comments