Tom Klein
12/16/2021, 4:15 AMTom Klein
12/16/2021, 4:15 AM[16 Dec 2021 6:03am]: Error during execution of task: DockerException("Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))")
Tom Klein
12/16/2021, 4:16 AMTom Klein
12/16/2021, 4:17 AMcreate_lichy = CreateContainer(image_name='lichy:1.0', container_name='my_lichy', command='npm run run')
Kevin Kho
Tom Klein
12/16/2021, 4:26 AMTom Klein
12/16/2021, 4:27 AM-v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker
Kevin Kho
Kevin Kho
-v /var/run/docker.sock:/var/run/docker.sock
on the agent run command I thinkTom Klein
12/16/2021, 4:43 AMTom Klein
12/16/2021, 4:44 AMTom Klein
12/16/2021, 4:45 AMdocker run
though… not sure that’s the agentKevin Kho
docker run
anywhere when you do this, and the agent takes in the volume
argument alsoTom Klein
12/16/2021, 4:49 AMTom Klein
12/16/2021, 4:50 AMKevin Kho
Tom Klein
12/16/2021, 5:46 AMprint_log
task or something if i need to ? (since otherwise i have no way of logging task-library tasks)
in any case: ListContainers
- for whatever reason, this one behaves really weird, while all its siblings behave fine
it forces me to do .run()
on the class, otherwise it behaves as if just running the task returns the class or something…Tom Klein
12/16/2021, 5:48 AMcreate_lichy = CreateContainer(image_name='lichy:1.0', container_name='my_lichy', command='npm run run',log_stdout=True)
run_lichy = StartContainer(log_stdout=True)
wait_on_lichy = WaitOnContainer(log_stdout=True)
list_lichy = ListContainers(all_containers=True, filters={"name":"my_lichy"}, log_stdout=True)
lichy_logs = GetContainerLogs(log_stdout=True)
Kevin Kho
Tom Klein
12/16/2021, 5:48 AMlichy_list = list_lichy()
if len(lichy_list) == 0:
lichy_id = create_lichy()
print_stuff(f"Lichy container does not exist, created one with id: {lichy_id}")
else:
lichy_id = lichy_list[0].get('Id')
print_stuff(f"Lichy containr already exists, id: {lichy_id}")
run_lichy(container_id=lichy_id)
lichy_res = wait_on_lichy(container_id=lichy_id)
print_stuff(lichy_res)
Tom Klein
12/16/2021, 5:49 AMTom Klein
12/16/2021, 5:49 AM.run()
it complains:Tom Klein
12/16/2021, 5:49 AM~/Prefect/hb-prefect$ python3 build.py
Traceback (most recent call last):
File "build.py", line 2, in <module>
from flows import xkcd, hello, seg_pred_backfill
File "/home/ubuntu/Prefect/hb-prefect/flows/seg_pred_backfill.py", line 80, in <module>
if len(lichy_list) == 0:
TypeError: object of type 'ListContainers' has no len()
Kevin Kho
if
inside the Flow block because it’s not a task so it’s executed immediately. You need to use the case
task insteadTom Klein
12/16/2021, 5:50 AM.run()
, but --- then i don’t see the task in the cloud UI….?Tom Klein
12/16/2021, 5:50 AMTom Klein
12/16/2021, 5:51 AMKevin Kho
run()
forces the run during your registration I think and it becomes registered with whatever the list was as a constantTom Klein
12/16/2021, 4:31 PMif
seemed to make the IDE complain about the type mismatch 🤔 (prompting me to add the .run()
)