def process( self, pool: "ThreadPoolExecutor") -> polyaxon_sdk.V1AgentStateResponse: try: agent_state = self.get_state() if agent_state.compatible_updates: self.sync_compatible_updates(agent_state.compatible_updates) if agent_state: logger.info("Starting runs submission process.") else: logger.info("No state was found.") return polyaxon_sdk.V1AgentStateResponse() state = agent_state.state for run_data in state.schedules or []: pool.submit(self.submit_run, run_data) for run_data in state.queued or []: pool.submit(self.submit_run, run_data) for run_data in state.stopping or []: pool.submit(self.stop_run, run_data) for run_data in state.apply or []: pool.submit(self.apply_run, run_data) for run_data in state.deleting or []: pool.submit(self.delete_run, run_data) for run_data in state.hooks or []: pool.submit(self.make_and_create_run, run_data) for run_data in state.watchdogs or []: pool.submit(self.make_and_create_run, run_data) for run_data in state.tuners or []: pool.submit(self.make_and_create_run, run_data, True) return agent_state except Exception as exc: logger.error(exc) return polyaxon_sdk.V1AgentStateResponse()
def process(self, pool: "ThreadPoolExecutor") -> polyaxon_sdk.V1AgentStateResponse: try: agent_state = self.get_state() if agent_state: logger.info("Starting runs submission process.") else: logger.info("No state was found.") return polyaxon_sdk.V1AgentStateResponse() state = agent_state.state for run_data in state.queued or []: pool.submit(self.create_run, run_data) for run_data in state.stopping or []: pool.submit(self.stop_run, run_data) for run_data in state.apply or []: pool.submit(self.apply_run, run_data) return agent_state except Exception as exc: logger.error(exc) return polyaxon_sdk.V1AgentStateResponse()