66from servicelib .long_running_tasks .models import LRTNamespace , TaskId
77from servicelib .rabbitmq ._client_rpc import RabbitMQRPCClient
88
9- from ..modules .long_running_tasks import (
10- task_containers_restart ,
11- task_create_service_containers ,
12- task_ports_inputs_pull ,
13- task_ports_outputs_pull ,
14- task_ports_outputs_push ,
15- task_pull_user_servcices_docker_images ,
16- task_restore_state ,
17- task_runs_docker_compose_down ,
18- task_save_state ,
19- )
9+ from ..modules import long_running_tasks
2010
2111
2212def _get_task_id_from_error (e : TaskAlreadyRunningError ) -> str :
@@ -30,7 +20,7 @@ async def pull_user_services_docker_images(
3020 return await lrt_api .start_task (
3121 rpc_client ,
3222 lrt_namespace ,
33- task_pull_user_servcices_docker_images .__name__ ,
23+ long_running_tasks . task_pull_user_servcices_docker_images .__name__ ,
3424 unique = True ,
3525 )
3626 except TaskAlreadyRunningError as e :
@@ -46,7 +36,7 @@ async def create_service_containers_task(
4636 return await lrt_api .start_task (
4737 rpc_client ,
4838 lrt_namespace ,
49- task_create_service_containers .__name__ ,
39+ long_running_tasks . task_create_service_containers .__name__ ,
5040 unique = True ,
5141 containers_create = containers_create ,
5242 )
@@ -61,7 +51,7 @@ async def runs_docker_compose_down_task(
6151 return await lrt_api .start_task (
6252 rpc_client ,
6353 lrt_namespace ,
64- task_runs_docker_compose_down .__name__ ,
54+ long_running_tasks . task_runs_docker_compose_down .__name__ ,
6555 unique = True ,
6656 )
6757 except TaskAlreadyRunningError as e :
@@ -75,7 +65,7 @@ async def state_restore_task(
7565 return await lrt_api .start_task (
7666 rpc_client ,
7767 lrt_namespace ,
78- task_restore_state .__name__ ,
68+ long_running_tasks . task_restore_state .__name__ ,
7969 unique = True ,
8070 )
8171 except TaskAlreadyRunningError as e :
@@ -89,7 +79,7 @@ async def state_save_task(
8979 return await lrt_api .start_task (
9080 rpc_client ,
9181 lrt_namespace ,
92- task_save_state .__name__ ,
82+ long_running_tasks . task_save_state .__name__ ,
9383 unique = True ,
9484 )
9585 except TaskAlreadyRunningError as e :
@@ -105,7 +95,7 @@ async def ports_inputs_pull_task(
10595 return await lrt_api .start_task (
10696 rpc_client ,
10797 lrt_namespace ,
108- task_ports_inputs_pull .__name__ ,
98+ long_running_tasks . task_ports_inputs_pull .__name__ ,
10999 unique = True ,
110100 port_keys = port_keys ,
111101 )
@@ -122,7 +112,7 @@ async def ports_outputs_pull_task(
122112 return await lrt_api .start_task (
123113 rpc_client ,
124114 lrt_namespace ,
125- task_ports_outputs_pull .__name__ ,
115+ long_running_tasks . task_ports_outputs_pull .__name__ ,
126116 unique = True ,
127117 port_keys = port_keys ,
128118 )
@@ -135,7 +125,10 @@ async def ports_outputs_push_task(
135125) -> TaskId :
136126 try :
137127 return await lrt_api .start_task (
138- rpc_client , lrt_namespace , task_ports_outputs_push .__name__ , unique = True
128+ rpc_client ,
129+ lrt_namespace ,
130+ long_running_tasks .task_ports_outputs_push .__name__ ,
131+ unique = True ,
139132 )
140133 except TaskAlreadyRunningError as e :
141134 return _get_task_id_from_error (e )
@@ -148,7 +141,7 @@ async def containers_restart_task(
148141 return await lrt_api .start_task (
149142 rpc_client ,
150143 lrt_namespace ,
151- task_containers_restart .__name__ ,
144+ long_running_tasks . task_containers_restart .__name__ ,
152145 unique = True ,
153146 )
154147 except TaskAlreadyRunningError as e :
0 commit comments