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

support for older python versions #242

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions src/conductor/client/http/models/state_change_event.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
from typing import Union, List
from typing import Union, List, Dict
from typing_extensions import Self


Expand All @@ -14,15 +14,15 @@ class StateChangeEventType(Enum):
class StateChangeEvent:
swagger_types = {
'type': 'str',
'payload': 'dict[str, object]'
'payload': 'Dict[str, object]'
}

attribute_map = {
'type': 'type',
'payload': 'payload'
}

def __init__(self, type: str, payload: dict[str, object]) -> None:
def __init__(self, type: str, payload: Dict[str, object]) -> None:
self._type = type
self._payload = payload

Expand All @@ -39,7 +39,7 @@ def payload(self):
return self._payload

@payload.setter
def payload(self, payload: dict[str, object]) -> Self:
def payload(self, payload: Dict[str, object]) -> Self:
self._payload = payload


Expand Down
6 changes: 3 additions & 3 deletions src/conductor/client/http/models/workflow_task.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pprint
import re # noqa: F401
from typing import List
from typing import List, Dict

import six

Expand Down Expand Up @@ -94,7 +94,7 @@ def __init__(self, name=None, task_reference_name=None, description=None, input_
sub_workflow_param=None, join_on=None, sink=None, optional=None, task_definition=None,
rate_limited=None, default_exclusive_join_task=None, async_complete=None, loop_condition=None,
loop_over=None, retry_count=None, evaluator_type=None, expression=None,
workflow_task_type=None, on_state_change: dict[str, StateChangeConfig] = None): # noqa: E501
workflow_task_type=None, on_state_change: Dict[str, StateChangeConfig] = None): # noqa: E501
"""WorkflowTask - a model defined in Swagger""" # noqa: E501
self._name = None
self._task_reference_name = None
Expand Down Expand Up @@ -817,7 +817,7 @@ def workflow_task_type(self, workflow_task_type):
self._workflow_task_type = workflow_task_type

@property
def on_state_change(self) -> dict[str, List[StateChangeEvent]]:
def on_state_change(self) -> Dict[str, List[StateChangeEvent]]:
return self._on_state_change

@on_state_change.setter
Expand Down
4 changes: 2 additions & 2 deletions src/conductor/client/orkes/orkes_secret_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List
from typing import List, Set

from conductor.client.configuration.configuration import Configuration
from conductor.client.orkes.models.metadata_tag import MetadataTag
Expand All @@ -16,7 +16,7 @@ def put_secret(self, key: str, value: str):
def get_secret(self, key: str) -> str:
return self.secretResourceApi.get_secret(key)

def list_all_secret_names(self) -> set[str]:
def list_all_secret_names(self) -> Set[str]:
return set(self.secretResourceApi.list_all_secret_names())

def list_secrets_that_user_can_grant_access_to(self) -> List[str]:
Expand Down
10 changes: 5 additions & 5 deletions src/conductor/client/orkes/orkes_workflow_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, List
from typing import Optional, List, Dict

from conductor.client.configuration.configuration import Configuration
from conductor.client.http.models import SkipTaskRequest, WorkflowStatus, \
Expand All @@ -23,7 +23,7 @@ def __init__(
def start_workflow_by_name(
self,
name: str,
input: dict[str, object],
input: Dict[str, object],
version: Optional[int] = None,
correlationId: Optional[str] = None,
priority: Optional[int] = None,
Expand Down Expand Up @@ -129,7 +129,7 @@ def get_by_correlation_ids_in_batch(
self,
batch_request: CorrelationIdsSearchRequest,
include_completed: bool = False,
include_tasks: bool = False) -> dict[str, List[Workflow]]:
include_tasks: bool = False) -> Dict[str, List[Workflow]]:

"""Given the list of correlation ids and list of workflow names, find and return workflows
Returns a map with key as correlationId and value as a list of Workflows
Expand All @@ -149,7 +149,7 @@ def get_by_correlation_ids(
correlation_ids: List[str],
include_completed: bool = False,
include_tasks: bool = False
) -> dict[str, List[Workflow]]:
) -> Dict[str, List[Workflow]]:
"""Lists workflows for the given correlation id list"""
kwargs = {}
if include_tasks:
Expand All @@ -166,5 +166,5 @@ def get_by_correlation_ids(
def remove_workflow(self, workflow_id: str):
self.workflowResourceApi.delete(workflow_id)

def update_variables(self, workflow_id: str, variables: dict[str, object] = {}) -> None:
def update_variables(self, workflow_id: str, variables: Dict[str, object] = {}) -> None:
self.workflowResourceApi.update_workflow_state(variables, workflow_id)
4 changes: 2 additions & 2 deletions src/conductor/client/secret_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import List
from typing import List, Set
from conductor.client.orkes.models.metadata_tag import MetadataTag


Expand All @@ -13,7 +13,7 @@ def get_secret(self, key: str) -> str:
pass

@abstractmethod
def list_all_secret_names(self) -> set[str]:
def list_all_secret_names(self) -> Set[str]:
pass

@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get_by_correlation_ids(
correlation_ids: List[str],
include_closed: bool = None,
include_tasks: bool = None
) -> dict[str, List[Workflow]]:
) -> Dict[str, List[Workflow]]:
"""Lists workflows for the given correlation id list"""
return self.workflow_client.get_by_correlation_ids(
correlation_ids=correlation_ids,
Expand Down
4 changes: 3 additions & 1 deletion src/conductor/client/workflow/task/simple_task.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Dict

from typing_extensions import Self

from conductor.client.workflow.task.task import TaskInterface
Expand All @@ -13,7 +15,7 @@ def __init__(self, task_def_name: str, task_reference_name: str) -> Self:
)


def simple_task(task_def_name: str, task_reference_name: str, inputs: dict[str, object]) -> TaskInterface:
def simple_task(task_def_name: str, task_reference_name: str, inputs: Dict[str, object]) -> TaskInterface:
task = SimpleTask(task_def_name=task_def_name, task_reference_name=task_reference_name)
task.input_parameters.update(inputs)
return task
8 changes: 4 additions & 4 deletions src/conductor/client/workflow_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import Optional, List
from typing import Optional, List, Dict

from conductor.client.http.models import WorkflowRun, SkipTaskRequest, WorkflowStatus, \
ScrollableSearchResultWorkflowSummary
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_by_correlation_ids_in_batch(
self,
batch_request: CorrelationIdsSearchRequest,
include_completed: bool = False,
include_tasks: bool = False) -> dict[str, List[Workflow]]:
include_tasks: bool = False) -> Dict[str, List[Workflow]]:
pass

@abstractmethod
Expand All @@ -91,13 +91,13 @@ def get_by_correlation_ids(
correlation_ids: List[str],
include_completed: bool = False,
include_tasks: bool = False
) -> dict[str, List[Workflow]]:
) -> Dict[str, List[Workflow]]:
pass

@abstractmethod
def remove_workflow(self, workflow_id: str):
pass

@abstractmethod
def update_variables(self, workflow_id: str, variables: dict[str, object] = {}) -> None:
def update_variables(self, workflow_id: str, variables: Dict[str, object] = {}) -> None:
pass
4 changes: 3 additions & 1 deletion tests/integration/metadata/test_workflow_definition.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

from conductor.client.http.models import TaskDef
from conductor.client.http.models.start_workflow_request import StartWorkflowRequest
from conductor.client.workflow.conductor_workflow import ConductorWorkflow
Expand All @@ -23,7 +25,7 @@ def run_workflow_definition_tests(workflow_executor: WorkflowExecutor) -> None:
test_kitchensink_workflow_registration(workflow_executor)


def generate_tasks_defs() -> list[TaskDef]:
def generate_tasks_defs() -> List[TaskDef]:
python_simple_task_from_code = TaskDef(
description="desc python_simple_task_from_code",
owner_app="python_integration_test_app",
Expand Down