Esempio n. 1
0
 def register(self, service_type, service_name, service_location):
     endpoint = f"/register/{service_type}/{service_name}/{service_location}"
     data = remote_call(self.location, endpoint)
     return data is not None
Esempio n. 2
0
 def locate(self, service_name):
     endpoint = f"/locate/{service_name}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('location')
     return None
Esempio n. 3
0
 def list(self):
     endpoint = f"/list"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('services')
     return None
Esempio n. 4
0
 def setnodes(self, ci_name, nodelist):
     endpoint = f"/setnodes/{ci_name}"
     data = remote_call(self.location, endpoint, payload=nodelist)
     return data is not None
Esempio n. 5
0
 def task(self, task_id):
     endpoint = f"/task/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('status'), data.get('nodelist'), data.get('nnodes')
     return 'error', None, None
Esempio n. 6
0
 def terminate(self, task_id):
     endpoint = f"/terminate/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('output')
     return None
Esempio n. 7
0
 def cancel(self, task_id):
     endpoint = f"/cancel/{task_id}"
     data = remote_call(self.location, endpoint)
     return data is not None
Esempio n. 8
0
 def extractnodes(self, task_id):
     endpoint = f"/extractnodes/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('nodelist')
     return None
Esempio n. 9
0
 def reservenodes(self, ci_name, nnodes, node_type):
     endpoint = f"/reservenodes/{ci_name}/{nnodes}/{node_type}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('task_id')
     return None
Esempio n. 10
0
 def tasklist(self):
     endpoint = f"/tasklist"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('tasks')
     return None