Example 3: Workflow validation and status checking
()
| 65 | |
| 66 | |
| 67 | def status_example(): |
| 68 | """Example 3: Workflow validation and status checking""" |
| 69 | client = SimStudioClient(api_key=os.getenv("SIM_API_KEY")) |
| 70 | |
| 71 | try: |
| 72 | # Check if workflow is ready |
| 73 | is_ready = client.validate_workflow("your-workflow-id") |
| 74 | print(f"Workflow ready: {is_ready}") |
| 75 | |
| 76 | # Get detailed status |
| 77 | status = client.get_workflow_status("your-workflow-id") |
| 78 | print(f"Status: {{\n" |
| 79 | f" deployed: {status.is_deployed},\n" |
| 80 | f" needs_redeployment: {status.needs_redeployment},\n" |
| 81 | f" deployed_at: {status.deployed_at}\n" |
| 82 | f"}}") |
| 83 | |
| 84 | if status.is_deployed: |
| 85 | # Execute the workflow |
| 86 | result = client.execute_workflow("your-workflow-id") |
| 87 | print(f"Result: {result}") |
| 88 | |
| 89 | except Exception as error: |
| 90 | print(f"Error: {error}") |
| 91 | |
| 92 | |
| 93 | def context_manager_example(): |
no test coverage detected