Example #1
0
def clean_other_jobs():
    ''' Cleans jobs not defined in the session '''
    if compmake.compmake_status == compmake_status_slave:
        return
    from compmake.ui.console import ask_question

    answers = {'a':'a', 'n':'n', 'y':'y', 'N':'N'}
    clean_all = False
    
    for job_id in all_jobs(force_db=True):
        if not job_id in  jobs_defined_in_this_session:
            if not clean_all:
                answer = ask_question(
                "Found spurious job %s; cleaning? [y]es, [a]ll, [n]o, [N]one " \
                    % job_id, allowed=answers)
                
                if answer == 'n':
                    continue
                
                if answer == 'N':
                    break
                
                if answer == 'a':
                    clean_all = True
                
            clean_target(job_id)
            delete_job(job_id)
Example #2
0
def remake(non_empty_job_list):  
    '''Remake the selected targets (equivalent to clean and make). '''
    
    non_empty_job_list = list(non_empty_job_list) 
        
    
    from compmake.ui.console import ask_question
    if get_compmake_status() == compmake_status_interactive: 
        question = "Should I clean and remake %d jobs? [y/n] " % \
            len(non_empty_job_list)
        answer = ask_question(question)
        if not answer:
            info('Not cleaned.')
            return
        
    for job in non_empty_job_list:
        mark_remake(job)
    
    manager = ManagerLocal()
    manager.add_targets(non_empty_job_list)
    manager.process()
    
    if manager.failed:
        return RET_CODE_JOB_FAILED
    else:
        return 0
Example #3
0
def clean(job_list):
    '''Cleans the result of the selected computation \
(or everything is nothing specified). '''

    job_list = list(job_list)
    
    if not job_list:
        job_list = list(all_jobs())
        
    if not job_list:
        return 
    
    from compmake.ui.console import ask_question
    
    if get_compmake_status() == compmake_status_interactive: 
        question = "Should I clean %d jobs? [y/n] " % len(job_list)
        answer = ask_question(question)
        if not answer:
            info('Not cleaned.')
            return
        
    for job_id in job_list:
        clean_target(job_id)