예제 #1
0
    def doPost(self):
        """Missing DocString

        :return:
        """
        post_cmds = []

        if not afcommon.checkBlockFlag( self.taskInfo['block_flags'],'skipthumbnails'):
            post_cmds.extend(self.generateThumbnail( False))

        # post_cmds.extend(['ls -la > ' + self.taskInfo['store_dir'] + '/afile'])

        return post_cmds
예제 #2
0
파일: service.py 프로젝트: fsimerey/cgru
    def doPost(self):
        """Missing DocString

        :return:
        """
        post_cmds = []

        if not afcommon.checkBlockFlag( self.taskInfo['block_flags'],'skipthumbnails'):
            post_cmds.extend(self.generateThumbnail( False))

        # post_cmds.extend(['ls -la > ' + self.taskInfo['store_dir'] + '/afile'])

        return post_cmds
예제 #3
0
파일: service.py 프로젝트: fsimerey/cgru
 def isSkippingExistingFiles(self):
     return afcommon.checkBlockFlag( self.taskInfo['block_flags'], 'skipexistingfiles')
예제 #4
0
 def isSkippingExistingFiles(self):
     return afcommon.checkBlockFlag(self.taskInfo['block_flags'],
                                    'skipexistingfiles')
예제 #5
0
파일: af.py 프로젝트: RISEFX/cgru
 def setSlaveLostIgnore(self):
     if not afcommon.checkBlockFlag(self.data['flags'], 'multihost'):
         print('Block::setSlaveLostIgnore: Block is not multihost.')
         return
     self.data['flags'] = afcommon.setBlockFlag(self.data['flags'], 'slavelostignore')
예제 #6
0
 def setSlaveLostIgnore(self):
     if not afcommon.checkBlockFlag(self.data['flags'], 'multihost'):
         print('Block::setSlaveLostIgnore: Block is not multihost.')
         return
     self.data['flags'] = afcommon.setBlockFlag(self.data['flags'], 'slavelostignore')
예제 #7
0
    def __init__(self, taskInfo, i_verbose):
        self.taskInfo = taskInfo
        self.verbose = i_verbose
        self.log = None

        self.numeric = afcommon.checkBlockFlag(taskInfo['block_flags'],
                                               'numeric')
        if self.verbose: print(taskInfo)

        self.pm = cgrupathmap.PathMap()

        self.str_capacity = str_capacity
        self.str_hosts = str_hosts
        self.str_hostsprefix = str_hostsprefix
        self.str_hostseparator = str_hostseparator

        # Transfer working folder:
        taskInfo['wdir'] = self.pm.toClient(taskInfo['wdir'])

        # Process command:
        command = self.processCommandPattern()

        # Transfer command:
        command = self.pm.toClient(command)

        # Apply capacity:
        if self.taskInfo['capacity'] > 0:
            command = self.applyCmdCapacity(command)

        # Apply hosts (multihosts tasks):
        if len(self.taskInfo['hosts']):
            command = self.applyCmdHosts(command)

        taskInfo['command'] = command
        if self.verbose:
            print('Processed task command:\n' + command)

        # Process files:
        taskInfo['files'] = self.processFilesPattern()
        if self.verbose:
            print('Processed task files:')
            for afile in taskInfo['files']:
                print(afile)

        # Transfer paths in files:
        for i in range(0, len(self.taskInfo['files'])):
            self.taskInfo['files'][i] = \
                self.pm.toClient(self.taskInfo['files'][i])

        # Check files:
        if self.isSkippingExistingFiles() and len(self.taskInfo['files']):
            self.checkExistingFiles()

        # Transfer paths in environment:
        for name in self.taskInfo['environment']:
            self.taskInfo['environment'][name] = self.pm.toClient(
                self.taskInfo['environment'][name])

        # When GUI receives task exec to show files,
        # server sends exec with parsed files.
        for i in range(0, len(self.taskInfo['parsed_files'])):
            self.taskInfo['parsed_files'][i] = \
                self.pm.toClient(self.taskInfo['parsed_files'][i])

        # Initialize parser:
        self.parser = None
        parser = cgruutils.toStr(taskInfo['parser'])
        if len(taskInfo['parser']):
            try:
                mod = __import__('parsers', globals(), locals(), [parser])
                cmd = 'mod.%s.%s()' % (parser, parser)
                self.parser = eval(cmd)
                self.parser.setTaskInfo(taskInfo)
            except:  # TODO: too broad exception clause
                self.parser = None
                print('ERROR: Failed to import parser "%s"' % parser)
                traceback.print_exc(file=sys.stdout)

        if self.verbose and self.log and len(self.log):
            print(self.log)
예제 #8
0
파일: afcmd.py 프로젝트: mikedatsik/cgru
 def hasAppendedTasks(self):
     return afcommon.checkBlockFlag(self.flags, 'appendedtasks')
예제 #9
0
파일: afcmd.py 프로젝트: mikedatsik/cgru
 def isNumeric(self):
     return bool(afcommon.checkBlockFlag(self.flags, 'numeric'))