diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b6a55e..a4014d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,9 @@ on: pull_request: branches: - "**" - types: - - ready_for_review - - synchronize + # types: + # - ready_for_review + # - synchronize jobs: pre-commit: diff --git a/workflow/cli/run.py b/workflow/cli/run.py index 3ecaf53..22c2600 100644 --- a/workflow/cli/run.py +++ b/workflow/cli/run.py @@ -208,17 +208,19 @@ def run( ) else: # Missing Logging config in Workspace - config.update({ - "logging": { - "loki": { - "tags": { - # Assumes that there is only one bucket - "pipeline": buckets[0], - "site": site, + config.update( + { + "logging": { + "loki": { + "tags": { + # Assumes that there is only one bucket + "pipeline": buckets[0], + "site": site, + } } } } - }) + ) loki_status: bool = configure.loki(logger=logger, config=config) logger.info(f"Loki Logs: {'✅' if loki_status else '❌'}") http: HTTPContext = HTTPContext(backends=["buckets"]) diff --git a/workflow/http/buckets.py b/workflow/http/buckets.py index 6b36a75..f52779c 100644 --- a/workflow/http/buckets.py +++ b/workflow/http/buckets.py @@ -148,7 +148,7 @@ def delete_many( tags: Optional[List[str]] = None, parent: Optional[str] = None, force: bool = False, - limit: Optional[int] = 100 + limit: Optional[int] = 100, ) -> bool: """Delete works belonging to a pipeline from the buckets backend. diff --git a/workflow/http/configs.py b/workflow/http/configs.py index b41b83b..9b1744f 100644 --- a/workflow/http/configs.py +++ b/workflow/http/configs.py @@ -164,7 +164,6 @@ def info(self) -> Dict[str, Any]: server_info = response.json() return {"client": client_info, "server": server_info} - @retry( reraise=True, wait=wait_random(min=0.3, max=1.8), stop=(stop_after_delay(15)) ) diff --git a/workflow/lifecycle/configure.py b/workflow/lifecycle/configure.py index 068bd90..52e823a 100644 --- a/workflow/lifecycle/configure.py +++ b/workflow/lifecycle/configure.py @@ -142,7 +142,8 @@ def defaults(func: Callable[..., Any], work: Work) -> Work: if hasattr(parameter, "is_flag") and parameter.is_flag: if parameter_default_value is True: - # Flags aren't assigned values, its CLI name is just included or not included + # Flags aren't assigned values + # its CLI name is just included or not included options[name_in_cli] = None else: options[name_in_cli] = parameter_default_value @@ -151,7 +152,8 @@ def defaults(func: Callable[..., Any], work: Work) -> Work: if hasattr(parameter, "is_flag") and parameter.is_flag: if parameter_given_value is True: - # Flags aren't assigned values, its CLI name is just included or not included + # Flags aren't assigned values + # its CLI name is just included or not included options[name_in_cli] = None else: options[name_in_cli] = parameter_given_value diff --git a/workflow/utils/renderers.py b/workflow/utils/renderers.py index ed3d9f7..17c5368 100644 --- a/workflow/utils/renderers.py +++ b/workflow/utils/renderers.py @@ -11,10 +11,22 @@ from workflow.utils.variables import status_colors, status_symbols -def render_timestamp(timestamp: float): - timestamp = dt.datetime.fromtimestamp(timestamp) - timestamp = dt.datetime.strftime(timestamp, "%m-%d-%Y, %H:%M:%S") - return timestamp +def render_timestamp(timestamp: float) -> str: + """Converts a timestamp into a readable string. + + Parameters + ---------- + timestamp : float + Timestamp. + + Returns + ------- + str + Formatted timestamp. + """ + from_dt: dt.datetime = dt.datetime.fromtimestamp(timestamp) + formatted_dt: str = dt.datetime.strftime(from_dt, "%m-%d-%Y, %H:%M:%S") + return formatted_dt def render_pipeline(payload: Dict[str, Any], history: bool = False) -> Text: @@ -24,6 +36,8 @@ def render_pipeline(payload: Dict[str, Any], history: bool = False) -> Text: ---------- payload : Dict[str, Any] Pipeline payload. + history : bool + If history field needs to be rendered. Returns ------- @@ -41,7 +55,7 @@ def render_pipeline(payload: Dict[str, Any], history: bool = False) -> Text: continue key_value_text = Text() if k in time_fields and v: - v = render_timestamp(v) + v = render_timestamp(float(v)) if k == steps_field: key_value_text = Text(f"{k}: \n", style="bright_blue") for step in v: @@ -50,7 +64,7 @@ def render_pipeline(payload: Dict[str, Any], history: bool = False) -> Text: elif k == history_field: key_value_text = Text(f"{k}: \n", style="bright_blue") for timestamp in v.keys(): - rendered = render_timestamp(int(timestamp)) + rendered = render_timestamp(float(timestamp)) key_value_text.append(f" {rendered}:\n", style="bright_green") for execution in v[timestamp].keys(): key_value_text.append(f"{' ' * 4}{execution}:\n") @@ -96,7 +110,7 @@ def render_config(http: HTTPContext, payload: Dict[str, Any]) -> Text: continue key_value_text = Text() if k in time_fields and v: - v = render_timestamp(v) + v = render_timestamp(float(v)) if k == "pipelines": key_value_text.append(f"{k}: \n", style="bright_blue") for status in pipelines_statuses: