示例#1
0
import os

from compmake.jobs import top_targets, tree

from compmake.jobs.storage import get_job_cache 
from compmake.structures import UserError, Cache
from compmake.ui.helpers import ui_section, VISUALIZATION, ui_command
from compmake.utils import  info
from compmake.jobs.queries import direct_children

ui_section(VISUALIZATION)

@ui_command
def graph(job_list, filename='compmake', compact=0,
          filter='dot', format='png'):
    '''Creates a graph of the given targets and dependencies 
    
        graph filename=filename compact=0,1 format=png,...
         
        Params:
            filename:  name of generated filename in the dot format
            compact=0: whether to include the job names in the nodes  
            filter=[dot,circo,twopi,...]  which algorithm to use to arrange
                       the nodes. This depends on the topology of your 
                       computation. The default is 'dot' 
                       (hierarchy top-bottom). 
            format=[png,...]  The output file format.
    '''
    if not job_list:
        job_list = top_targets()
    
示例#2
0
文件: dump.py 项目: welinder/compmake
import cPickle as pickle, os

from compmake.utils import  info, user_error
from compmake.ui.helpers import   INPUT_OUTPUT, ui_section, ui_command

from compmake.jobs.storage import \
    get_job_userobject, is_job_userobject_available


ui_section(INPUT_OUTPUT)

@ui_command
def dump(non_empty_job_list, directory='.'):
    '''Dumps the content of jobs as pickle files.

Arguments: 
    directory='.'   where to dump the files
    
'''
    for job_id in non_empty_job_list:
        
        if is_job_userobject_available(job_id):
            user_object = get_job_userobject(job_id)
            filename = os.path.join(directory, job_id + '.pickle')
            with open(filename, 'w') as f:
                pickle.dump(user_object, f)
            info('Wrote %s' % filename)
        else:
            user_error('Job %s is not ready yet.' % job_id)