Пример #1
0
    def create_dag_jobs(self, run_name):
        # Creates the directories on the file system if they are not already created
        self.log_file_dir, self.out_file_dir, self.err_file_dir = create_condor_directories(run_name, self.condor_path)

        # Topological sort is great for ordering these files in the order they will execute.
        for node in nx.topological_sort(self.graph.G):
            output_file_name = str(run_name) + "_JOB" + str(self.associated_bash_files[node][0])

            # If to run with a GPU or not (Moreso if to request one)
            if int(self.graph.G.node[node]['gpus']) >= 1:
                current_job = Job((self.condor_path + run_name + "/" + run_name + ".gpu.submit"), "JOB" +
                                  str(self.associated_bash_files[node][0]))
            else:
                current_job = Job((self.condor_path + run_name + "/" + run_name + ".submit"), "JOB" +
                                  str(self.associated_bash_files[node][0]))

            """
            Adding memory request and cpu request
            Because we create a bunch of shell files that are run, there are not args.
            """
            self.static_job_values(current_job, output_file_name)
            current_job.add_var("args", "")
            current_job.add_var("mem", self.graph.G.node[node]['mem'])
            current_job.add_var("cpus", self.graph.G.node[node]['cpus'])

            # If a GPU file, then add the number of GPUs requested
            if int(self.graph.G.node[node]['gpus']) >= 1:
                current_job.add_var("gpus", self.graph.G.node[node]['gpus'])

            # Run the created SH file
            current_job.add_var("execute", self.condor_path + run_name + "/" + self.associated_bash_files[node][1])

            # Still need to add parent interactions, which is done in the comm stack
            self.dag_jobs[node] = current_job