def train(self, model_builder, job_args): """Runs the training process to train a model. Arguments: model_builder: the ModelBuilder to use to build graphs during training. job_args: the arguments for the training job. Returns: The trained Model. The resulting value is only relevant for master nodes. """ job = Job(model_builder, job_args.output, self._config) job.configure_logging() server = self._config.create_server() if server and self._config.param_server: return self._run_ps(server) return self._run_training(server, job)
def wait_all(jobs, timeout=None): """ Return when at all of the specified jobs have completed or timeout expires. Args: jobs: a single Job or list of Jobs to wait on. timeout: a timeout in seconds to wait for. None (the default) means no timeout. Returns: A list of completed Jobs. If the call timed out this will be shorter than the list of jobs supplied as a parameter. """ return Job.wait_all(jobs, timeout)
def wait_any(jobs, timeout=None): """ Return when at least one of the specified jobs has completed or timeout expires. Args: jobs: a list of Jobs to wait on. timeout: a timeout in seconds to wait for. None (the default) means no timeout. Returns: Once at least one job completes, a list of all completed jobs. If the call times out then an empty list will be returned. """ return Job.wait_any(jobs, timeout)