|
29 | 29 | ReRunRequest, |
30 | 30 | ScheduleQueriesSearchRequest, |
31 | 31 | Workflow, |
| 32 | + WorkflowMetadata, |
32 | 33 | WorkflowResponse, |
33 | 34 | WorkflowRunResponse, |
34 | 35 | WorkflowSchedule, |
@@ -407,20 +408,29 @@ def update_owner(self, workflow_name: str, username: str) -> WorkflowResponse: |
407 | 408 |
|
408 | 409 | @validate_arguments(config=dict(arbitrary_types_allowed=True)) |
409 | 410 | def monitor( |
410 | | - self, workflow_response: WorkflowResponse, logger: Optional[Logger] = None |
| 411 | + self, |
| 412 | + workflow_response: Optional[WorkflowResponse] = None, |
| 413 | + workflow_name: Optional[str] = None, |
| 414 | + logger: Optional[Logger] = None, |
411 | 415 | ) -> Optional[AtlanWorkflowPhase]: |
412 | 416 | """ |
413 | 417 | Monitor the status of the workflow's run. |
414 | 418 |
|
415 | 419 | :param workflow_response: The workflow_response returned from running the workflow |
| 420 | + :param workflow_name: name of the workflow to be monitored |
416 | 421 | :param logger: the logger to log status information |
417 | 422 | (logging.INFO for summary info. logging:DEBUG for detail info) |
418 | 423 | :returns: the status at completion or None if the workflow wasn't run |
419 | 424 | :raises ValidationError: If the provided `workflow_response`, `logger` is invalid |
420 | 425 | :raises AtlanError: on any API communication issue |
421 | 426 | """ |
422 | | - if workflow_response.metadata and workflow_response.metadata.name: |
423 | | - name = workflow_response.metadata.name |
| 427 | + if workflow_name and not workflow_response: |
| 428 | + workflow_response = WorkflowResponse( |
| 429 | + metadata=WorkflowMetadata(name=workflow_name) |
| 430 | + ) |
| 431 | + |
| 432 | + if workflow_response.metadata and workflow_response.metadata.name: # type: ignore |
| 433 | + name = workflow_response.metadata.name # type: ignore |
424 | 434 | status: Optional[AtlanWorkflowPhase] = None |
425 | 435 | while status not in { |
426 | 436 | AtlanWorkflowPhase.SUCCESS, |
|
0 commit comments