async def create_job(self, namespace, name, image, command=None, args=None, cpu_limit=None, mem_limit=None, envvars={}, volumes=None, volumeMounts=None, envFrom=None, entrypoint=None, **kw): url, version = POST_OPS['job'] url = url.format(namespace=namespace, name=name, endpoint=self.endpoint, scheme=self.scheme) obj = K8SJob(namespace=namespace, name=name, image=image, command=command, args=args, cpu_limit=cpu_limit, mem_limit=mem_limit, envvars=envvars, volumes=volumes, volumeMounts=volumeMounts, envFrom=envFrom, entrypoint=entrypoint, **kw) return await self.post(url, version, obj.payload())
async def get_job(self, namespace, name): url = GET_OPS["job"] 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 K8SJob(data=result)
def __init__(self, data=None, **kw): self._raw = data self._jobs = [] for job in self._raw['items']: self._jobs.append(K8SJob(data=job))