Esempio n. 1
0
    def test_get_task_summary(self):
        con = CHMConfig('./images', './model', './outdir', '500x500', '20x20')
        cfig = configparser.ConfigParser()
        cfig.add_section('1')
        cfig.set('1', 'hi', 'val')
        cfig.add_section('2')
        cfig.set('2', 'hi', 'val')
        con.set_config(cfig)

        mfig = configparser.ConfigParser()
        mfig.add_section('3')
        mfig.set('3', 'hi', 'val')
        con.set_merge_config(mfig)

        tsf = TaskSummaryFactory(con,
                                 chm_incomplete_tasks=[],
                                 merge_incomplete_tasks=['a'])
        ts = tsf.get_task_summary()
        self.assertEqual(
            ts.get_summary(), 'chmutil version: unknown\n'
            'Tiles: 500x500 with 20x20 '
            'overlap\nDisable histogram '
            'equalization in CHM: True\n'
            'Tasks: 1 tiles per task, 1 '
            'tasks(s) per node\nTrained '
            'CHM model: ./model\nCHM binary: '
            './chm-0.1.0.img\n\nCHM tasks: '
            '100% complete (2 of 2 completed)'
            '\nMerge tasks: 0% complete (0 of '
            '1 completed)\n')
Esempio n. 2
0
def _check_chm_job(theargs):
    """Runs all jobs for task
    """
    sys.stdout.write('\nAnalyzing job. This may take a minute...\n\n')

    if theargs.detailed:
        sys.stdout.write('In fact this may take extra long cause '
                         '--detailed was set\n')
        sys.stdout.write('WARNING: Runtime information is new and'
                         ' may contain errors\n\n')

    chmconfig = _get_chmconfig(theargs.jobdir)
    if theargs.skipchm is False:
        chm_task_list = _get_incompleted_chm_task_list(chmconfig.get_config())
    else:
        logger.info("--skipchm set to True. Skipping examination of CHM jobs.")
        chm_task_list = []

    merge_task_list = _get_incompleted_merge_task_list(
        chmconfig.get_merge_config())

    tsf = TaskSummaryFactory(chmconfig,
                             chm_incomplete_tasks=chm_task_list,
                             merge_incomplete_tasks=merge_task_list,
                             output_compute=theargs.detailed)
    ts = tsf.get_task_summary()

    sys.stdout.write(ts.get_summary() + '\n')

    if theargs.submit is True:
        logger.info(SUBMIT_FLAG + ' set')
        return _submit(chmconfig, chm_task_list, merge_task_list)
    return 0