-
Notifications
You must be signed in to change notification settings - Fork 16
feat(sdk): implement SDK orchestrator service enhancements #830
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
base: main
Are you sure you want to change the base?
Conversation
Implement comprehensive SDK service standardization across 5 core Orchestrator
services
AssetsService:
- Add list() iterator with OData support and auto-pagination
- Add exists() boolean check for asset existence
- Add get_value() convenience method
- Add delete() for asset removal
- Add async variants for all new methods
- Fix retrieve() to raise LookupError when not found
FolderService:
- Add list() iterator with OData filtering
- Add retrieve() with dual-mode lookup (display_name or key)
- Add retrieve_by_path() for path-based lookup
- Add exists() and exists_async() checks
- Add create() and delete() folder operations
- Full async/sync parity across all methods
JobsService:
- Add list() iterator for job enumeration
- Add retrieve() by job_key or job_id
- Add exists() check for job existence
- Add stop(), suspend(), resume() control operations
- Full async variants for all operations
ProcessesService:
- Add list() iterator for process/release enumeration
- Add retrieve() by key or process_id
- Add exists() check for process existence
- Add invoke() convenience wrapper
- Full async/sync parity
QueuesService (Two-Level Architecture):
Queue Definitions:
- Add list_definitions() iterator with OData support
- Add retrieve_definition() by name or key
- Add create_definition() for queue creation
- Add delete_definition() for cleanup
- Add exists_definition() check
Queue Items:
- Add create_item() for adding queue items
- Add list_items() iterator with status filtering
- Full async variants for all operations
160e2c5 to
1857837
Compare
| """Async version of list().""" | ||
| current_skip = skip | ||
|
|
||
| while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation paginates using skip, which becomes extremely expensive as the offset grows. Once skip hits tens/hundreds of thousands, the Orchestrator backend starts doing deep OFFSET scans — that means high DB load, slow responses, and potential timeouts.
We already have customers with hundreds of thousands to millions of assets/jobs/queue items. With that volume, this loop will:
- Absolutely destroy the Orchestrator API with unbounded requests
- Cause DB pressure and latency spikes
- Likely trigger throttling or 5xx errors at scale and an incident.
| """Async version of list() with auto-pagination.""" | ||
| current_skip = skip | ||
|
|
||
| while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all while True from list methods. Without proper filters, the best we can do is retrieve top 100 results
| Args: | ||
| name: Asset name (must be unique within folder) | ||
| value: Asset value | ||
| value_type: Type of asset ("Text", "Integer", "Boolean", "Credential") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have type Secret.
| asset = await self.retrieve_async( | ||
| name=name, folder_key=folder_key, folder_path=folder_path | ||
| ) | ||
| return asset.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot retrieve the value of an asset type secret or credential. We need a way to let the user know that this can only happen at runtime and mark the CLI output with "***"
| self, | ||
| *, | ||
| job_keys: Optional[List[str]] = None, | ||
| job_ids: Optional[List[int]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't leak integer ids in the SDK. We only work with keys GUIDs
| response = self.request( | ||
| spec.method, | ||
| url=spec.endpoint, | ||
| params=spec.params, | ||
| headers=spec.headers, | ||
| ).json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many orchestrator APIs also implement rate limiting with standard headers. The Get jobs API is limited to 100 calls per minute per tenant. We need to ensure that the sdk obeys the rate limit for all endpoints (as we may introduce more limits in the future).
https://docs.uipath.com/orchestrator/automation-cloud/latest/api-guide/rate-limits#exposed-headers
| skip=current_skip, | ||
| top=top, | ||
| ) | ||
| response = self.request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a user agent that can identify traffic coming from the sdk. We often needed this for mitigating incidents, or analyzing consumer patterns.
Implement comprehensive SDK service standardization across 5 core Orchestrator services
(to fill in a feature gap required for more complete CLI)
AssetsService:
- Add list() iterator with OData support and auto-pagination
- Add exists() boolean check for asset existence
- Add get_value() convenience method
- Add delete() for asset removal
- Add async variants for all new methods
- Fix retrieve() to raise LookupError when not found
FolderService:
- Add list() iterator with OData filtering
- Add retrieve() with dual-mode lookup (display_name or key)
- Add retrieve_by_path() for path-based lookup
- Add exists() and exists_async() checks
- Add create() and delete() folder operations
- Full async/sync parity across all methods
JobsService:
- Add list() iterator for job enumeration
- Add retrieve() by job_key or job_id
- Add exists() check for job existence
- Add stop(), suspend(), resume() control operations
- Full async variants for all operations
ProcessesService:
- Add list() iterator for process/release enumeration
- Add retrieve() by key or process_id
- Add exists() check for process existence
- Add invoke() convenience wrapper
- Full async/sync parity
QueuesService (Two-Level Architecture):
Queue Definitions:
- Add list_definitions() iterator with OData support
- Add retrieve_definition() by name or key
- Add create_definition() for queue creation
- Add delete_definition() for cleanup
- Add exists_definition() check
Queue Items:
- Add create_item() for adding queue items
- Add list_items() iterator with status filtering
- Full async variants for all operations