def _setup_reporters(is_interactive_run, ee_id): reporters = [] if is_interactive_run: reporters.append(reporting.Interactive()) elif ee_id: reporters.append(reporting.File(sync_disc_timeout=0)) reporters.append(reporting.Network()) reporters.append(reporting.Event()) else: reporters.append(reporting.File()) reporters.append(reporting.Network()) return reporters
def main(args): # If run_path is defined, enter into that directory if len(args) > 1: run_path = args[1] if not os.path.exists(run_path): sys.exit("No such directory: {}".format(run_path)) os.chdir(run_path) jobs_to_run = [] if len(args) > 2: jobs_to_run = args[2:] reporters = [] is_interactive_run = len(args) > 2 if is_interactive_run: reporters.append(reporting.Interactive()) else: reporters.append(reporting.File()) reporters.append(reporting.Network()) job_runner = JobRunner() for job_status in job_runner.run(jobs_to_run): for reporter in reporters: reporter.report(job_status) if isinstance(job_status, Finish) and not job_status.success(): pgid = os.getpgid(os.getpid()) os.killpg(pgid, signal.SIGKILL)
def _setup_reporters(is_interactive_run, ee_id, evaluator_url, ee_token=None, ee_cert_path=None): reporters = [] if is_interactive_run: reporters.append(reporting.Interactive()) elif ee_id: reporters.append(reporting.File(sync_disc_timeout=0)) reporters.append(reporting.Network()) reporters.append( reporting.Event(evaluator_url=evaluator_url, token=ee_token, cert_path=ee_cert_path)) else: reporters.append(reporting.File()) reporters.append(reporting.Network()) return reporters