예제 #1
0
def get_all_ids_names(mps_db):
    """Returns two lists containing the mille job IDs and the associated names.
    
    Arguments:
    - `mps_db`: path to the MPS database file
    """

    lib = mpslib.jobdatabase()
    lib.read_db(mps_db)

    ids = lib.JOBNUMBER[:lib.nJobs]
    names = lib.JOBSP3[:lib.nJobs]

    return ids, names
예제 #2
0
def get_all_ids_names(mps_db):
    """Returns two lists containing the mille job IDs and the associated names.
    
    Arguments:
    - `mps_db`: path to the MPS database file
    """

    lib = mpslib.jobdatabase()
    lib.read_db(mps_db)

    ids = lib.JOBNUMBER[:lib.nJobs]
    names = lib.JOBSP3[:lib.nJobs]

    return ids, names
예제 #3
0
            print "Creating pede jobs using settings from '{0}'.".format(
                setting)
        for weight_conf in weight_confs:
            print "-" * 60
            # blank weights
            handle_process_call(["mps_weight.pl", "-c"])

            for name, weight in weight_conf:
                handle_process_call(["mps_weight.pl", "-N", name, weight],
                                    True)

            # create new mergejob
            handle_process_call(["mps_setupm.pl"], True)

            # read mps.db to find directory of new mergejob
            lib = mpslib.jobdatabase()
            lib.read_db()

            # delete old merge-config
            command = [
                "rm", "-f",
                os.path.join("jobData", lib.JOBDIR[-1], "alignment_merge.py")
            ]
            handle_process_call(command, args.verbose)

            # create new merge-config
            command = [
                "mps_merge.py",
                "-w",
                thisCfgTemplate,
                os.path.join("jobData", lib.JOBDIR[-1], "alignment_merge.py"),
예제 #4
0

################################################################################
# mapping of HTCondor status codes to MPS status
htcondor_jobstatus = {"1": "PEND", # Idle
                      "2": "RUN",  # Running
                      "3": "EXIT", # Removed
                      "4": "DONE", # Completed
                      "5": "PEND", # Held
                      "6": "RUN",  # Transferring output
                      "7": "PEND"} # Suspended


################################################################################
# collect submitted jobs (use 'in' to handle composites, e.g. DISABLEDFETCH)
lib = mpslib.jobdatabase()
lib.read_db()

submitted_jobs = {}
for i in xrange(len(lib.JOBID)):
    submitted = True
    for status in ("SETUP", "OK", "DONE", "FETCH", "ABEND", "WARN", "FAIL"):
        if status in lib.JOBSTATUS[i]:
            submitted = False
            break
    if submitted:
        submitted_jobs[lib.JOBID[i]] = i
print "submitted jobs:", len(submitted_jobs)


################################################################################
예제 #5
0
    def _create_pede_jobs(self):
        """Create pede jobs from the given input."""

        for setting in self._pede_settings:
            print()
            print("="*75)
            if setting is None:
                print("Creating pede job{}.".format(
                    "s" if len(self._pede_settings)*len(self._weight_configs) > 1 else ""))
                print("-"*75)
            else:
                print("Creating pede jobs using settings from '{0}'.".format(setting))
            for weight_conf in self._weight_configs:
                # blank weights
                self._handle_process_call(["mps_weight.pl", "-c"])

                thisCfgTemplate = "tmp.py"
                with open(thisCfgTemplate, "w") as f: f.write(self._config_template)
                if self._override_gt is None:
                    self._cms_process = mps_tools.get_process_object(thisCfgTemplate)
                    self._create_input_db()
                with open(thisCfgTemplate, "a") as f: f.write(self._override_gt)

                for name,weight in weight_conf:
                    self._handle_process_call(["mps_weight.pl", "-N", name, weight], True)

                if not self._first_pede_config:
                    # create new mergejob
                    self._handle_process_call(["mps_setupm.pl"], self._args.verbose)

                # read mps.db to find directory of new mergejob
                lib = mpslib.jobdatabase()
                lib.read_db()

                # short cut for jobm path
                jobm_path = os.path.join("jobData", lib.JOBDIR[-1])

                # delete old merge-config
                command = ["rm", "-f", os.path.join(jobm_path, "alignment_merge.py")]
                self._handle_process_call(command, self._args.verbose)

                # create new merge-config
                command = [
                    "mps_merge.py",
                    "-w", thisCfgTemplate,
                    os.path.join(jobm_path, "alignment_merge.py"),
                    jobm_path,
                    str(lib.nJobs),
                ]
                if setting is not None: command.extend(["-a", setting])
                print("-"*75)
                print(" ".join(command))
                self._handle_process_call(command, self._args.verbose)
                self._create_tracker_tree()
                if self._first_pede_config:
                    os.symlink(self._tracker_tree_path,
                               os.path.abspath(os.path.join(jobm_path,
                                                            ".TrackerTree.root")))
                    self._first_pede_config = False

                # store weights configuration
                with open(os.path.join(jobm_path, ".weights.pkl"), "wb") as f:
                    cPickle.dump(weight_conf, f, 2)
                print("="*75)

        # remove temporary file
        self._handle_process_call(["rm", thisCfgTemplate])
예제 #6
0
    def _create_pede_jobs(self):
        """Create pede jobs from the given input."""

        for setting in self._pede_settings:
            print
            print "="*75
            if setting is None:
                print "Creating pede job{}.".format(
                    "s" if len(self._pede_settings)*len(self._weight_configs) > 1 else "")
                print "-"*75
            else:
                print "Creating pede jobs using settings from '{0}'.".format(setting)
            for weight_conf in self._weight_configs:
                # blank weights
                self._handle_process_call(["mps_weight.pl", "-c"])

                thisCfgTemplate = "tmp.py"
                with open(thisCfgTemplate, "w") as f: f.write(self._config_template)
                if self._override_gt is None:
                    self._cms_process = mps_tools.get_process_object(thisCfgTemplate)
                    self._create_input_db()
                with open(thisCfgTemplate, "a") as f: f.write(self._override_gt)

                for name,weight in weight_conf:
                    self._handle_process_call(["mps_weight.pl", "-N", name, weight], True)

                if not self._first_pede_config:
                    # create new mergejob
                    self._handle_process_call(["mps_setupm.pl"], self._args.verbose)

                # read mps.db to find directory of new mergejob
                lib = mpslib.jobdatabase()
                lib.read_db()

                # short cut for jobm path
                jobm_path = os.path.join("jobData", lib.JOBDIR[-1])

                # delete old merge-config
                command = ["rm", "-f", os.path.join(jobm_path, "alignment_merge.py")]
                self._handle_process_call(command, self._args.verbose)

                # create new merge-config
                command = [
                    "mps_merge.py",
                    "-w", thisCfgTemplate,
                    os.path.join(jobm_path, "alignment_merge.py"),
                    jobm_path,
                    str(lib.nJobs),
                ]
                if setting is not None: command.extend(["-a", setting])
                print "-"*75
                print " ".join(command)
                self._handle_process_call(command, self._args.verbose)
                self._create_tracker_tree()
                if self._first_pede_config:
                    os.symlink(self._tracker_tree_path,
                               os.path.abspath(os.path.join(jobm_path,
                                                            ".TrackerTree.root")))
                    self._first_pede_config = False

                # store weights configuration
                with open(os.path.join(jobm_path, ".weights.pkl"), "wb") as f:
                    cPickle.dump(weight_conf, f, 2)
                print "="*75

        # remove temporary file
        self._handle_process_call(["rm", thisCfgTemplate])
예제 #7
0
#!/usr/bin/env python
import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass as mpslib
import os

#use mps_update.py in shell and push output to nirvana
os.system("mps_update.py >| /dev/null")  #add >| /dev/null

lib = mpslib.jobdatabase()	#create object of class jobdatabase
lib.read_db()				#read mps.db into the jobdatabase
lib.print_memdb()			#print the jobdatabase in memory