def wait(self, app_handle: AppHandle) -> Optional[AppStatus]: scheduler_backend, _, app_id = parse_app_handle(app_handle) tsm_event = self._generate_tsm_event("wait", scheduler_backend, app_id) try: record_tsm(tsm_event) return self._wait(app_handle) except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def list(self) -> Dict[AppHandle, Application]: tsm_event = self._generate_tsm_event("list", "") try: res = self._list() record_tsm(tsm_event) return res except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def status(self, app_handle: AppHandle) -> Optional[AppStatus]: # allow status checks of apps from other sessions scheduler_backend, _, app_id = parse_app_handle(app_handle) tsm_event = self._generate_tsm_event("status", scheduler_backend, app_id) try: app_status = self._status(app_handle) record_tsm(tsm_event) return app_status except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def stop(self, app_handle: AppHandle) -> None: scheduler_backend, _, app_id = parse_app_handle(app_handle) tsm_event = self._generate_tsm_event( "stop", scheduler_backend, app_id, ) try: self._stop(app_handle) record_tsm(tsm_event) except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def describe(self, app_handle: AppHandle) -> Optional[Application]: scheduler_backend, _, app_id = parse_app_handle(app_handle) tsm_event = self._generate_tsm_event( "describe", scheduler_backend, app_id, ) try: res = self._describe(app_handle) record_tsm(tsm_event) return res except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def schedule(self, dryrun_info: AppDryRunInfo) -> AppHandle: scheduler_backend = dryrun_info._scheduler runcfg = json.dumps( dryrun_info._cfg.cfgs) if dryrun_info._cfg else None tsm_event = self._generate_tsm_event( "schedule", scheduler_backend, runcfg=runcfg, ) try: app_handle = self._schedule(dryrun_info) _, _, app_id = parse_app_handle(app_handle) tsm_event.app_id = app_id # TODO(avivanou): t81936552 each action corresponds to a method call # as a result instead of repeatedly log events in each method, we # can log them implicitly via footsteps lib record_tsm(tsm_event) return app_handle except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise
def log_lines( self, app_handle: AppHandle, role_name: str, k: int = 0, regex: Optional[str] = None, since: Optional[datetime] = None, until: Optional[datetime] = None, ) -> Iterable: scheduler_backend, _, app_id = parse_app_handle(app_handle) tsm_event = self._generate_tsm_event( "log_lines", scheduler_backend, app_id, ) try: log_iter = self._log_lines(app_handle, role_name, k, regex, since, until) record_tsm(tsm_event) return log_iter except Exception: tsm_event.raw_exception = traceback.format_exc() record_tsm(tsm_event) raise