async def get_tfjob(self, namespace, name):
     url = GET_OPS["tfjob"]
     url = url.format(namespace=namespace, name=name, endpoint=self.endpoint, scheme=self.scheme)
     result = await self.get(url)
     if result is None:
         return None
     else:
         return K8STFJob(data=result)
Example #2
0
 async def create_tfjob(
     self,
     namespace,
     name,
     image,
     command=None,
     args=None,
     cpu_limit=None,
     mem_limit=None,
     envvars={},
     workers=1,
     ps=1,
     masters=1,
     tb_gs=None,
     volumes=None,
     volumeMounts=None,
     envFrom=None,
     entrypoint=None,
     **kw,
 ):
     url, version = POST_OPS["tfjob"]
     url = url.format(namespace=namespace,
                      name=name,
                      endpoint=self.endpoint,
                      scheme=self.scheme)
     obj = K8STFJob(
         namespace=namespace,
         name=name,
         image=image,
         command=command,
         args=args,
         cpu_limit=cpu_limit,
         mem_limit=mem_limit,
         envvars=envvars,
         workers=workers,
         ps=ps,
         masters=masters,
         tb_gs=tb_gs,
         volumes=volumes,
         volumeMounts=volumeMounts,
         envFrom=envFrom,
         entrypoint=entrypoint,
         **kw,
     )
     return await self.post(url, version, obj.payload())
Example #3
0
 def __init__(self, data=None, **kw):
     self._raw = data
     self._jobs = []
     for job in self._raw['items']:
         self._jobs.append(K8STFJob(data=job))