1- # import tohil
2-
3- # tcl=tohil.import_tcl()
41import subprocess
52
63if __name__ == "__main__" :
107 import sys
118 sys .path .append (plugin_site_packages )
129
13- def myfunction ():
14- return "65"
15-
1610def isDockerAvailable ():
1711 # if docker is installed and available
1812 try :
@@ -46,10 +40,8 @@ def isDockerRunningContainer(image_name, external_port=-1):
4640 args ,
4741 check = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
4842 container_ids = result .stdout .decode ().strip ().split ('\n ' )
49- # tcl.W(container_ids)
5043 if container_ids == ['' ]:
5144 return 0
52- # tcl.W(len(container_ids))
5345 return len (container_ids )
5446 except (subprocess .CalledProcessError , FileNotFoundError ):
5547 return False
@@ -74,7 +66,7 @@ def killContainersFromImage(image_name, external_port=-1):
7466 return len (container_ids )
7567
7668 except subprocess .CalledProcessError as e :
77- return - 1 # Error al ejecutar docker
69+ return - 1
7870
7971def startContainerForImage (image_name , external_port , internal_port , modelname ):
8072 try :
@@ -86,18 +78,4 @@ def startContainerForImage(image_name, external_port, internal_port, modelname):
8678 return container_id
8779
8880 except subprocess .CalledProcessError as e :
89- return - 1 # Error al ejecutar docker
90-
91- # -np- GiD_Python_Source C:/Users/jgarate/Desktop/CODE/Other/GiDInterface/kratos.gid/exec/check_docker.py
92- # check_docker.check_docker()
93- # -np- GiD_Python_Exec check_docker.check_docker()
94-
95- # -np- GiD_Python_Import_File C:/Users/jgarate/Desktop/CODE/Other/GiDInterface/kratos.gid/exec/check_docker.py
96- # -np- GiD_Python_Exec check_docker.check_docker()
97-
98- # print(isDockerAvailable())
99- # print(isDockerRunning())
100- # print(isDockerRunningContainer("flowgraph"))
101- # print(killContainersFromImage("flowgraph"))
102- # print(killContainersFromImage("flowgraph", 8080))
103- # print(startContainerForImage("flowgraph", 8080, 80, "C:\\Users\\jgarate\\Desktop\\bbb.gid")) # Adjust the model path as needed
81+ return - 1
0 commit comments