def debug_func(user=None, address=None, authkey=None, save=None): create_interrupt() params = {"Job": TestJob} tasks = {i: {"task_name": i, "out_pth": "test_{}.res".format(i), "complete": False} for i in xrange(5)} ## TODO: complete raise NotImplementedError()
def client_func(user=None, address=None, authkey=None, save=False): create_interrupt() client = ClientManager(user=user, address=fqaddr(address), authkey=authkey) client.connect() # Number of processors. n_procs = 1 kwargs = dict(save=save) client.start(n_procs=n_procs, kwargs=kwargs)
def server_func(user=None, address=None, authkey=None, save=None): create_interrupt() server = ServerManager(user=user, address=fqaddr(address), authkey=authkey, save=save) params = {"Job": TestJob} tasks = {i: {"task_name": i, "out_pth": "test_{}.res".format(i), "complete": False} for i in xrange(5)} # Create the server and start it. server.start(params, tasks)
def start_server(job_cls, script_dir, exp, tag, force=False, save=False, user=None, address=None, authkey=None): """ Start a distributed job server.""" create_interrupt() # Set up parameters and task data. script_pth = path.joinpath(script_dir, exp, "cfg_{}.pkl".format(tag)) params = job_cls.get_params(script_pth) params["save"] = save tasks = job_cls.create_tasks(params) # Create the server and start it. server = ServerManager(user=user, address=address, authkey=authkey) server.start(params, tasks, force=force)
def start_client(job_cls, save=False, graphics=False, timeout=310, user=None, address=None, authkey=None, n_procs=None): """ Start a distributed job client.""" create_interrupt() # Number of processors. if graphics: n_procs = 1 elif n_procs is None: n_procs = cpu_count() # job_cls-specific parameters. kwargs = dict(save=save, graphics=graphics) # Set up params and task parameters. client = ClientManager(user=user, address=address, authkey=authkey) client.start(n_procs=n_procs, kwargs=kwargs, timeout=timeout)
def start_debug(job_cls, script_dir, exp, tag, force=False, save=False, graphics=False): """ Distributed job debugger.""" create_interrupt() script_pth = path.joinpath(script_dir, exp, "cfg_{}.pkl".format(tag)) params = job_cls.get_params(script_pth) tasks = job_cls.create_tasks(params) job = job_cls(params, save=save, graphics=graphics) job.setup() for taskname in sorted(tasks): task = tasks[taskname] progress, tmp_fid = job.run(task) if tmp_fid: path(tmp_fid.name).copy2(task["out_pth"]) tmp_fid.close() progress.report() job.teardown()