def submit(self, cmd_string, tasks_per_node, job_name="parsl"): """ Submit a job Args: - cmd_string :(String) - Name of the container to initiate - tasks_per_node (int) : command invocations to be launched per node Kwargs: - job_name (String): Name for job, must be unique Returns: - None: At capacity, cannot provision more - job_id: (string) Identifier for the job """ cur_timestamp = str(time.time() * 1000).split(".")[0] job_name = "{0}-{1}".format(job_name, cur_timestamp) if not self.pod_name: pod_name = '{}'.format(job_name) else: pod_name = '{}-{}'.format(self.pod_name, cur_timestamp) formatted_cmd = template_string.format(command=cmd_string, worker_init=self.worker_init) logger.debug("Pod name :{}".format(pod_name)) self._create_pod(image=self.image, pod_name=pod_name, job_name=job_name, cmd_string=formatted_cmd, volumes=self.persistent_volumes) self.resources[pod_name] = {'status': JobStatus(JobState.RUNNING)} return pod_name
def submit(self, cmd_string, blocksize, tasks_per_node, job_name="parsl.auto"): """ Submit a job Args: - cmd_string :(String) - Name of the container to initiate - blocksize :(float) - Number of replicas - tasks_per_node (int) : command invocations to be launched per node Kwargs: - job_name (String): Name for job, must be unique Returns: - None: At capacity, cannot provision more - job_id: (string) Identifier for the job """ if not self.resources: job_name = "{0}-{1}".format(job_name, time.time()).split(".")[0] self.deployment_name = '{}-{}-deployment'.format( job_name, str(time.time()).split('.')[0]) formatted_cmd = template_string.format( command=cmd_string, worker_init=self.worker_init) print("Creating replicas :", self.init_blocks) self.deployment_obj = self._create_deployment_object( job_name, self.image, self.deployment_name, cmd_string=formatted_cmd, replicas=self.init_blocks, volumes=self.persistent_volumes) logger.debug("Deployment name :{}".format(self.deployment_name)) self._create_deployment(self.deployment_obj) self.resources[self.deployment_name] = { 'status': 'RUNNING', 'pods': self.init_blocks } return self.deployment_name