Ejemplo n.º 1
0
    def setCondorChirpAttrDelayed(self, key, value, compress=False, maxLen=5120):
        """
        _setCondorChirpAttrDelayed_

        Util to call condor_chirp and publish the key/value pair

        """
        if compress:
            value = zipEncodeStr(value, maxLen=maxLen)

        # construct condor_chirp binary location from CONDOR_CONFIG
        condor_chirp_bin = None
        condor_config = os.getenv('CONDOR_CONFIG', None)
        if condor_config:
            condor_config_dir = os.path.dirname(condor_config)
            condor_chirp_bin = os.path.join(condor_config_dir, 'main/condor/libexec/condor_chirp')
            if not os.path.isfile(condor_chirp_bin):
                # Singularity container might not have CONDOR_CONFIG env.
                #TODO: It should have fixed from Singularity setting
                condor_chirp_bin = getFullPath("condor_chirp")

        if condor_chirp_bin and os.access(condor_chirp_bin, os.X_OK):
            args = [condor_chirp_bin, 'set_job_attr_delayed', key, json.dumps(value)]
            subprocess.call(args)

        return
Ejemplo n.º 2
0
    def setCondorChirpAttrDelayed(self, key, value, compress=False, maxLen=5120):
        """
        _setCondorChirpAttrDelayed_

        Util to call condor_chirp and publish the key/value pair

        """
        if compress:
            value = zipEncodeStr(value, maxLen=maxLen)

        # construct condor_chirp binary location from CONDOR_CONFIG
        # Note: This works when we do not use containers.
        condor_chirp_bin = None
        condor_config = os.getenv('CONDOR_CONFIG', None)
        if condor_config:
            condor_config_dir = os.path.dirname(condor_config)
            condor_chirp_bin = os.path.join(condor_config_dir, 'main/condor/libexec/condor_chirp')

        # If the above fails, look for the executable in the environment
        # This is the usual case for containers
        if not condor_chirp_bin or not os.path.isfile(condor_chirp_bin):
            condor_chirp_bin = getFullPath("condor_chirp")

        if condor_chirp_bin and os.access(condor_chirp_bin, os.X_OK):
            args = [condor_chirp_bin, 'set_job_attr_delayed', key, json.dumps(value)]
            subprocess.call(args)
        else:
            if condor_chirp_bin and not os.access(condor_chirp_bin, os.X_OK):
                msg = 'condor_chirp was found in: %s, but it was not an executable.' % condor_chirp_bin
            else:
                msg = 'condor_chirp was not found in the system.'
            self.logger.warning(msg)

        return
Ejemplo n.º 3
0
    def setCondorChirpAttrDelayed(self,
                                  key,
                                  value,
                                  compress=False,
                                  maxLen=5120):
        """
        _setCondorChirpAttrDelayed_

        Util to call condor_chirp and publish the key/value pair

        """
        if compress:
            value = zipEncodeStr(value, maxLen=maxLen)

        # construct condor_chirp binary location from CONDOR_CONFIG
        condor_chirp_bin = None
        condor_config = os.getenv('CONDOR_CONFIG', None)
        if condor_config:
            condor_config_dir = os.path.dirname(condor_config)
            condor_chirp_bin = os.path.join(
                condor_config_dir, 'main/condor/libexec/condor_chirp')
            if not os.path.isfile(condor_chirp_bin):
                # Singularity container might not have CONDOR_CONFIG env.
                #TODO: It should have fixed from Singularity setting
                condor_chirp_bin = getFullPath("condor_chirp")

        if condor_chirp_bin and os.access(condor_chirp_bin, os.X_OK):
            args = [
                condor_chirp_bin, 'set_job_attr_delayed', key,
                json.dumps(value)
            ]
            subprocess.call(args)

        return