diff --git a/README.md b/README.md index ee6eb9f1..958dfbe3 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ Create a `quickstart.py` with the following: ```python from conductor.client.automator.task_handler import TaskHandler from conductor.client.configuration.configuration import Configuration -from conductor.client.orkes_clients import OrkesClients # works with OSS Conductor and Orkes Conductor +from conductor.client.orkes_clients import ConductorClients # OrkesClients is an alias for the same class from conductor.client.workflow.conductor_workflow import ConductorWorkflow from conductor.client.worker.worker_task import worker_task @@ -121,7 +121,7 @@ def main(): # Configure the SDK (reads CONDUCTOR_SERVER_URL / CONDUCTOR_AUTH_* from env). config = Configuration() - clients = OrkesClients(configuration=config) + clients = ConductorClients(configuration=config) executor = clients.get_workflow_executor() # Build a workflow with the >> operator. @@ -329,10 +329,10 @@ Full lifecycle control — start, execute, pause, resume, terminate, retry, rest ```python from conductor.client.configuration.configuration import Configuration from conductor.client.http.models import StartWorkflowRequest, RerunWorkflowRequest, TaskResult -from conductor.client.orkes_clients import OrkesClients +from conductor.client.orkes_clients import ConductorClients config = Configuration() -clients = OrkesClients(configuration=config) +clients = ConductorClients(configuration=config) workflow_client = clients.get_workflow_client() task_client = clients.get_task_client() executor = clients.get_workflow_executor() diff --git a/src/conductor/client/__init__.py b/src/conductor/client/__init__.py index c79f4cec..d168f232 100644 --- a/src/conductor/client/__init__.py +++ b/src/conductor/client/__init__.py @@ -3,7 +3,7 @@ from conductor.client.configuration.configuration import Configuration from conductor.client.automator.task_handler import TaskHandler from conductor.client.automator.task_runner import TaskRunner -from conductor.client.orkes_clients import OrkesClients +from conductor.client.orkes_clients import OrkesClients, ConductorClients from conductor.client.workflow.conductor_workflow import ConductorWorkflow from conductor.client.workflow.executor.workflow_executor import WorkflowExecutor from conductor.client.worker.worker_task import worker_task @@ -18,6 +18,7 @@ "TaskHandler", "TaskRunner", "OrkesClients", + "ConductorClients", "ConductorWorkflow", "WorkflowExecutor", "worker_task", diff --git a/src/conductor/client/orkes_clients.py b/src/conductor/client/orkes_clients.py index 08a76c4c..51078b19 100644 --- a/src/conductor/client/orkes_clients.py +++ b/src/conductor/client/orkes_clients.py @@ -55,3 +55,6 @@ def get_prompt_client(self) -> PromptClient: def get_schema_client(self) -> SchemaClient: return OrkesSchemaClient(self.configuration) + + +ConductorClients = OrkesClients diff --git a/tests/unit/test_conductor_clients.py b/tests/unit/test_conductor_clients.py new file mode 100644 index 00000000..4de7629e --- /dev/null +++ b/tests/unit/test_conductor_clients.py @@ -0,0 +1,33 @@ +from conductor.client.orkes_clients import OrkesClients, ConductorClients +from conductor.client import ConductorClients as ConductorClientsFromPkg +from conductor.client.configuration.configuration import Configuration + + +def test_alias_is_same_class(): + assert ConductorClients is OrkesClients + + +def test_package_export_is_same_class(): + assert ConductorClientsFromPkg is OrkesClients + + +def test_conductor_clients_instantiates(): + config = Configuration(server_api_url='http://localhost:8080/api') + clients = ConductorClients(configuration=config) + assert isinstance(clients, OrkesClients) + + +def test_conductor_clients_default_config(): + clients = ConductorClients() + assert clients.configuration is not None + + +def test_conductor_clients_get_methods(): + config = Configuration(server_api_url='http://localhost:8080/api') + clients = ConductorClients(configuration=config) + assert clients.get_workflow_executor() is not None + assert clients.get_workflow_client() is not None + assert clients.get_task_client() is not None + assert clients.get_metadata_client() is not None + assert clients.get_scheduler_client() is not None + assert clients.get_secret_client() is not None