How to use the dax.task function in dax

To help you get started, we’ve selected a few dax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VUIIS / dax / dax / dax_tools_utils.py View on Github external
cinfo = cobj.info()
            try:
                if isinstance(cobj, XnatUtils.CachedImageScan):
                    msg = "Processor.has_inputs(cobj) running on %s - %s - %s \
..."
                    print((msg % (project, cinfo['session_label'], cinfo['ID'])))
                else:
                    msg = "Processor.has_inputs(cobj) running on %s - %s ..."
                    print((msg % (project, cinfo['session_label'])))
                state, qcstatus = self.tobj.has_inputs(cobj)
                self.inc_test()
                qcstatus = qcstatus if qcstatus else task.JOB_PENDING
                if state == 0:
                    state = task.NEED_INPUTS
                elif state == 1:
                    state = task.NEED_TO_RUN
                elif state == -1:
                    state = task.NO_DATA
                else:
                    print(("[FAIL] State return by Processor.has_inputs() \
unknown (-1/0/1): %s" % state))
                    self.inc_fail()
                    return False
                print(("Outputs: state = %s and qcstatus = %s"
                      % (state, qcstatus)))
            except Exception:
                print('[ERROR]')
                exc_type, exc_value, exc_traceback = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_traceback,
                                          limit=2, file=sys.stdout)
                self.inc_error()
                return False
github VUIIS / dax / dax / dax_tools_utils.py View on Github external
print_sub_test('test_has_inputs')

        # Loop through the sessions
        for cobj in self.set_proc_cobjs_list(self.tobj, project, sessions):
            cinfo = cobj.info()
            try:
                if isinstance(cobj, XnatUtils.CachedImageScan):
                    msg = "Processor.has_inputs(cobj) running on %s - %s - %s \
..."
                    print((msg % (project, cinfo['session_label'], cinfo['ID'])))
                else:
                    msg = "Processor.has_inputs(cobj) running on %s - %s ..."
                    print((msg % (project, cinfo['session_label'])))
                state, qcstatus = self.tobj.has_inputs(cobj)
                self.inc_test()
                qcstatus = qcstatus if qcstatus else task.JOB_PENDING
                if state == 0:
                    state = task.NEED_INPUTS
                elif state == 1:
                    state = task.NEED_TO_RUN
                elif state == -1:
                    state = task.NO_DATA
                else:
                    print(("[FAIL] State return by Processor.has_inputs() \
unknown (-1/0/1): %s" % state))
                    self.inc_fail()
                    return False
                print(("Outputs: state = %s and qcstatus = %s"
                      % (state, qcstatus)))
            except Exception:
                print('[ERROR]')
                exc_type, exc_value, exc_traceback = sys.exc_info()
github VUIIS / dax / dax / launcher.py View on Github external
def task_needs_status_update(qcstatus):
    return qcstatus in [task.RERUN, task.REPROC]
github VUIIS / dax / dax / launcher.py View on Github external
def is_updatable_tasks(assr_info):
        """
        Check if a task is updatable.

        :param assr_info: dictionary containing procstatus/qcstatus
        :return: True if tasks need to be update, False otherwise.

        """
        good_proc = assr_info['procstatus'] in task.OPEN_STATUS_LIST
        good_qc = assr_info['qcstatus'] in task.OPEN_QA_LIST
        return good_proc or good_qc
github VUIIS / dax / dax / processors.py View on Github external
for edit_in in self.xnat_inputs.get('edits', list()):
                _fpref = edit_in['fpref']
                _var = edit_in['varname']

                # Filter files that match prefix
                cur_list = [f for f in file_list if f.startswith(_fpref)]

                if cur_list:
                    # Sort and grab the last file
                    _val = sorted(cur_list)[-1]

                    # Build full uri
                    _uri = '{}/data{}/out/resources/{}/files/{}'.format(
                        assr._intf.host,
                        assr_path,
                        task.EDITS_RESOURCE,
                        _val)

                    # Append to inputs to be downloaded
                    input_list.append({
                        'fdest': _fpref,
                        'ftype': 'FILE',
                        'fpath': _uri,
                        'ddest': ''
                    })

                    # Set the value for command text
                    var2val[_var] = '/INPUTS/'+_fpref

                else:
                    # None found
                    var2val[_var] = ''
github VUIIS / dax / dax / launcher.py View on Github external
LOGGER.info('launcher_type = %s' % self.launcher_type)

        res_dir = DAX_SETTINGS.get_results_dir()
        flagfile = os.path.join(os.path.join(res_dir, 'FlagFiles'),
                                '%s_%s' % (lockfile_prefix, LAUNCH_SUFFIX))

        project_list = self.init_script(flagfile, project_local,
                                        type_update=3, start_end=1)

        if project_list is None or len(project_list) == 0:
            LOGGER.info('no projects to launch')
        else:
            msg = 'Loading task queue from: %s'
            LOGGER.info(msg % os.path.join(res_dir, 'DISKQ'))
            task_list = load_task_queue(
                status=task.NEED_TO_RUN,
                proj_filter=project_list)

            msg = '%s tasks that need to be launched found'
            LOGGER.info(msg % str(len(task_list)))
            self.launch_tasks(task_list, force_no_qsub=force_no_qsub)

        self.finish_script(flagfile, project_list, 3, 2, project_local)
github VUIIS / dax / dax / launcher.py View on Github external
def task_needs_to_run(procstatus, qcstatus):
    return\
        procstatus in [task.NEED_TO_RUN, task.NEED_INPUTS] or\
        qcstatus in [task.RERUN, task.REPROC, task.DOES_NOT_EXIST]
github VUIIS / dax / dax / launcher.py View on Github external
def is_updatable_tasks(assr_info):
        """
        Check if a task is updatable.

        :param assr_info: dictionary containing procstatus/qcstatus
        :return: True if tasks need to be update, False otherwise.

        """
        good_proc = assr_info['procstatus'] in task.OPEN_STATUS_LIST
        good_qc = assr_info['qcstatus'] in task.OPEN_QA_LIST
        return good_proc or good_qc