Hey every one! does any one of you have experience...
# prefect-getting-started
p
Hey every one! does any one of you have experience with running long ssh commands via fabric in a task/flow? for me this fails after 15-20 seconds:
Copy code
@task
def run_command(c, command):
    return c.run(command, hide=HIDE)  # command is bash run_my_script.sh (this takes 30 mins)
I call
run_command()
like this:
Copy code
@flow
def my_remote_script_flow():
  # connect to the remote machine
  c_wd1 = connect_and_test(host, user, password)
        
  cmd = f"""cd /myfolder/path && bash my_script.sh"""
  run_command(c_wd1,cmd)
This fails with:
Copy code
17:01:45.884 | ERROR   | Flow run 'bold-ara' - Crash detected! Execution was cancelled by the runtime environment.
17:01:45.887 | DEBUG   | Flow run 'bold-ara' - Crash details:
Traceback (most recent call last):
  File "/Users/sam/miniconda3/envs/sam/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 327, in aresult
    return await asyncio.wrap_future(self.future)
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/sam/miniconda3/envs/sam/lib/python3.10/site-packages/prefect/engine.py", line 2207, in report_flow_run_crashes
    yield
  File "/Users/sam/miniconda3/envs/sam/lib/python3.10/site-packages/prefect/engine.py", line 718, in create_and_begin_subflow_run
    terminal_state = await orchestrate_flow_run(
  File "/Users/sam/miniconda3/envs/sam/lib/python3.10/site-packages/prefect/engine.py", line 875, in orchestrate_flow_run
    result = await flow_call.aresult()
  File "/Users/sam/miniconda3/envs/sam/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 329, in aresult
j
Correct me if I am wrong, but does flow call the
run_command
task, I only see
c_wd1
/`run` being run? Also, I had experiences in past where I needed to past the task runner, SequentialTaskRunner, through the Flow decorator Argument,
task_runner
Let me know if that helps
p
you are absolutly right... thanks! i tried to simplefy my example and messed up. Edit should be correct. I will check out your suggestion.
so this is still crashing with
10:04:47.894 | ERROR   | Task run 'run_command-0' - Crash detected! Execution was cancelled by the runtime environment.