def remake(non_empty_job_list, context, cq, echo=DefaultsToConfig('echo'), new_process=DefaultsToConfig('new_process'), recurse=DefaultsToConfig('recurse')): """ Remake the selected targets (equivalent to clean and make). :param non_empty_job_list: :param context: :param cq: :param echo: :param new_process:Run the jobs in a new Python process. :param recurse: Recursive remake: put generated jobs in """ non_empty_job_list = list(non_empty_job_list) if not ask_if_sure_remake(non_empty_job_list): return db = context.get_compmake_db() for job in non_empty_job_list: mark_to_remake(job, db=db) manager = ManagerLocal(context=context, cq=cq, recurse=recurse, new_process=new_process, echo=echo) manager.add_targets(non_empty_job_list) manager.process() return raise_error_if_manager_failed(manager)
def make(job_list, context, cq, echo=DefaultsToConfig('echo'), new_process=DefaultsToConfig('new_process'), recurse=DefaultsToConfig('recurse')): """ Makes selected targets; or all targets if none specified. Options: make recurse=1 Recursive make: put generated jobs in the queue. make new_process=1 Run the jobs in a new Python process. make echo=1 Displays the stdout/stderr for the job on the console. make new_process=1 echo=1 Not supported yet. """ db = context.get_compmake_db() if not job_list: job_list = list(top_targets(db=db)) manager = ManagerLocal(context=context, cq=cq, recurse=recurse, new_process=new_process, echo=echo) manager.add_targets(job_list) manager.process() return raise_error_if_manager_failed(manager)
def parremake(non_empty_job_list, context, cq, n=DefaultsToConfig('max_parallel_jobs'), recurse=DefaultsToConfig('recurse'), new_process=DefaultsToConfig('new_process'), echo=DefaultsToConfig('echo')): """ Parallel equivalent of "remake". """ # TODO: test this db = context.get_compmake_db() non_empty_job_list = list(non_empty_job_list) if not ask_if_sure_remake(non_empty_job_list): return for job in non_empty_job_list: mark_to_remake(job, db=db) manager = PmakeManager(num_processes=n, context=context, cq=cq, recurse=recurse, new_process=new_process, show_output=echo) manager.add_targets(non_empty_job_list) manager.process() return raise_error_if_manager_failed(manager)
def parmake(job_list, context, cq, n=DefaultsToConfig('max_parallel_jobs'), recurse=DefaultsToConfig('recurse'), new_process=DefaultsToConfig('new_process'), echo=DefaultsToConfig('echo')): """ Parallel equivalent of make. Uses multiprocessing.Process as a backend and a Python queue to communicate with the workers. Options: parmake n=10 Uses 10 workers parmake recurse=1 Recursive make: put generated jobs in the queue. parmake new_process=1 Run the jobs in a new Python process. parmake echo=1 Shows the output of the jobs. This might slow down everything. parmake new_process=1 echo=1 Not supported yet. """ publish(context, 'parmake-status', status='Obtaining job list') job_list = list(job_list) db = context.get_compmake_db() if not job_list: # XXX job_list = list(top_targets(db=db)) publish(context, 'parmake-status', status='Starting multiprocessing manager (forking)') manager = PmakeManager(num_processes=n, context=context, cq=cq, recurse=recurse, new_process=new_process, show_output=echo) publish(context, 'parmake-status', status='Adding %d targets.' % len(job_list)) manager.add_targets(job_list) publish(context, 'parmake-status', status='Processing') manager.process() return raise_error_if_manager_failed(manager)