Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/argo ns no debug prints #122

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[DEFAULT]
ARGO_ACCESS_METHOD = access
ARGO_HOST = http://argo-argo-workflows-server.argo.svc.cluster.local:2746
ARGO_NAMESPACE = argo
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL = http://cohort-middleware-service/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}
9 changes: 5 additions & 4 deletions src/argowrapper/constants.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from enum import Enum
from typing import Final
import re
import configparser
import os
import re
from enum import Enum
from typing import Final

from argowrapper import logger

config = configparser.ConfigParser()
Expand All @@ -25,7 +26,7 @@
]
TEST_WF: Final = "test.yaml"
WF_HEADER: Final = "header.yaml"
ARGO_NAMESPACE: Final = "argo"
ARGO_NAMESPACE: Final = config["DEFAULT"]["ARGO_NAMESPACE"]
TOKEN_REGEX: Final = re.compile("bearer", re.IGNORECASE)
ARGO_ACCESS_SERVICE: Final = "argo_workflow"
ARGO_ACCESS_METHOD: Final = config["DEFAULT"]["ARGO_ACCESS_METHOD"]
Expand Down
25 changes: 12 additions & 13 deletions src/argowrapper/engine/argo_engine.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
import string
import traceback
from datetime import datetime
from typing import Dict, List, Literal

import argo_workflows
from argo_workflows.api import (
archived_workflow_service_api,
workflow_service_api,
artifact_service_api,
workflow_service_api,
)
from argo_workflows.exceptions import NotFoundException
from argo_workflows.model.io_argoproj_workflow_v1alpha1_retry_archived_workflow_request import (
IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest,
)
from argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_create_request import (
IoArgoprojWorkflowV1alpha1WorkflowCreateRequest,
)
from argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_terminate_request import (
IoArgoprojWorkflowV1alpha1WorkflowTerminateRequest,
)
from argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_retry_request import (
IoArgoprojWorkflowV1alpha1WorkflowRetryRequest,
)
from argo_workflows.model.io_argoproj_workflow_v1alpha1_retry_archived_workflow_request import (
IoArgoprojWorkflowV1alpha1RetryArchivedWorkflowRequest,
from argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_terminate_request import (
IoArgoprojWorkflowV1alpha1WorkflowTerminateRequest,
)
from argo_workflows.exceptions import NotFoundException

from argowrapper import logger
from argowrapper.constants import (
ARGO_HOST,
ARGO_NAMESPACE,
WORKFLOW,
GEN3_USER_METADATA_LABEL,
GEN3_SUBMIT_TIMESTAMP_LABEL,
GEN3_TEAM_PROJECT_METADATA_LABEL,
GEN3_USER_METADATA_LABEL,
GEN3_WORKFLOW_PHASE_LABEL,
GEN3_SUBMIT_TIMESTAMP_LABEL,
WORKFLOW,
)
from argowrapper.engine.helpers import argo_engine_helper
from argowrapper.engine.helpers.workflow_factory import WorkflowFactory
from argowrapper.workflows.argo_workflows.gwas import GWAS

from datetime import datetime


class ArgoEngine:
"""
Expand Down Expand Up @@ -71,7 +70,6 @@ def __init__(self, dry_run: bool = False):
self.artifact_api_instance = artifact_service_api.ArtifactServiceApi(api_client)

def _get_workflow_details_dict(self, workflow_name: str) -> Dict:

return self.api_instance.get_workflow(
namespace=ARGO_NAMESPACE,
name=workflow_name,
Expand Down Expand Up @@ -426,6 +424,7 @@ def get_workflows_for_label_selector(self, label_selector: str) -> List[Dict]:
)
archived_workflow_list_return = (
self.archive_api_instance.list_archived_workflows(
namespace=ARGO_NAMESPACE,
list_options_label_selector=label_selector,
_check_return_type=False,
)
Expand Down
Loading