def apply_to_job(self, job: Job, *, job_name: str) -> None: if not self.partition: raise RuntimeError("A partition to run on must be specified.") qos_or_account = ( f"qos {self.partition}" if self.partition in (SCAVENGE, EPHEMERAL) else f"account {self.partition}" ) slurm_resource_content = SLURM_RESOURCE_STRING.format( qos_or_account=qos_or_account, partition=self.partition, num_cpus=self.num_cpus if self.num_cpus else 1, num_gpus=self.num_gpus if self.num_gpus is not None else 0, job_name=job_name, mem_str=to_slurm_memory_string( self.memory if self.memory else _SLURM_DEFAULT_MEMORY ), time=self.convert_time_to_slurm_format( self.job_time_in_minutes if self.job_time_in_minutes else _DEFAULT_JOB_TIME_IN_MINUTES ), ) logging.debug( "Slurm Resource Request for %s: %s", job_name, slurm_resource_content ) job.addProfile( Profile(Namespace.PEGASUS, "glite.arguments", slurm_resource_content) ) category_profile = Profile(Namespace.DAGMAN, "category", self.partition) if not job.hasProfile(category_profile): job.addProfile(category_profile)
"/bin/pegasus-keg", config.get('all', 'executable_site'))) sleep.addProfile( Profile(namespace="pegasus", key="clusters.size", value=config.get('all', 'clusters_size'))) sleep.addProfile( Profile(namespace="pegasus", key="clusters.maxruntime", value=config.get('all', 'clusters_maxruntime'))) cluster.addExecutable(sleep) for i in range(4): job = Job(namespace="cluster", name="level1", version="1.0") job.addArguments('-a level1 -T ' + str(i + 1)) job.addArguments('-i', a) job.addProfile( Profile(namespace="pegasus", key="job.runtime", value=str(i + 1))) job.uses(a, link=Link.INPUT) cluster.addJob(job) for j in range(4): child = Job(namespace="cluster", name="level2", version="1.0") child.addArguments('-a level2 -T ' + str((j + 1) * 2)) child.addProfile( Profile(namespace="pegasus", key="runtime", value=str( (j + 1) * 2))) cluster.addJob(child) cluster.depends(parent=job, child=child) # Write the DAX to standard out cluster.writeXML(sys.stdout)
# Add input file to the DAX-level replica catalog a = File("f.a") a.addPFN(PFN(config.get('all', 'file_url') + input_file + "/f.a", config.get('all', 'file_site'))) cluster.addFile(a) for i in range (1, 3): sleep = Executable (namespace = "cluster", name = "level" + str (i), version = "1.0", os = "linux", arch = "x86", installed=config.getboolean('all', 'executable_installed')) sleep.addPFN (PFN (config.get('all', 'executable_url') + sys.argv[1] + "/bin/pegasus-keg", config.get('all', 'executable_site'))) sleep.addProfile (Profile (namespace = "pegasus", key = "clusters.size", value = config.get('all', 'clusters_size'))) sleep.addProfile (Profile (namespace = "pegasus", key = "clusters.maxruntime", value = config.get('all', 'clusters_maxruntime'))) cluster.addExecutable(sleep) for i in range (4): job = Job (namespace = "cluster", name = "level1", version = "1.0") job.addArguments('-a level1 -T ' + str (i + 1)) job.addArguments('-i', a) job.addProfile (Profile (namespace = "pegasus", key = "job.runtime", value = str (i + 1))) job.uses(a, link=Link.INPUT) cluster.addJob (job) for j in range (4): child = Job (namespace = "cluster", name = "level2", version = "1.0") child.addArguments('-a level2 -T ' + str ((j + 1) * 2)) child.addProfile (Profile (namespace = "pegasus", key = "runtime", value = str ((j + 1) * 2))) cluster.addJob (child) cluster.depends (parent = job, child = child) # Write the DAX to standard out cluster.writeXML (sys.stdout)