コード例 #1
0
 def _resolve_crd_object_status_info(
         self, db: DBInterface, db_session: Session,
         crd_object) -> Tuple[bool, Optional[datetime], Optional[str]]:
     state = crd_object.get("status", {}).get("applicationState",
                                              {}).get("state")
     in_terminal_state = state in SparkApplicationStates.terminal_states()
     desired_run_state = SparkApplicationStates.spark_application_state_to_run_state(
         state)
     completion_time = None
     if in_terminal_state:
         completion_time = datetime.fromisoformat(
             crd_object.get("status", {}).get("terminationTime").replace(
                 "Z", "+00:00"))
     return in_terminal_state, completion_time, desired_run_state
コード例 #2
0
 def _update_ui_url(
     self,
     db: DBInterface,
     db_session: Session,
     project: str,
     uid: str,
     crd_object,
     run: Dict = None,
     leader_session: Optional[str] = None,
 ):
     app_state = (crd_object.get("status", {}).get("applicationState",
                                                   {}).get("state"))
     state = SparkApplicationStates.spark_application_state_to_run_state(
         app_state)
     ui_url = None
     if state == RunStates.running:
         ui_url = (crd_object.get("status",
                                  {}).get("driverInfo",
                                          {}).get("webUIIngressAddress"))
     db_ui_url = run.get("status", {}).get("ui_url")
     if db_ui_url == ui_url:
         return
     run.setdefault("status", {})["ui_url"] = ui_url
     db.store_run(db_session,
                  run,
                  uid,
                  project,
                  leader_session=leader_session)