clerk-sdk 0.2.2__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clerk_sdk-0.2.2/clerk_sdk.egg-info → clerk_sdk-0.2.5}/PKG-INFO +1 -1
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/decorators/gui_automation.py +18 -9
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5/clerk_sdk.egg-info}/PKG-INFO +1 -1
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/setup.py +1 -1
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/LICENSE +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/MANIFEST.in +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/README.md +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/base.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/client.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/decorator/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/decorator/models.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/decorator/task_decorator.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/action_model/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/action_model/model.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/action_model/utils.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/client.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/client_actor/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/client_actor/client_actor.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/client_actor/exception.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/client_actor/model.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/decorators/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/exceptions/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/exceptions/websocket.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/requirements.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_actions/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_actions/actions.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_actions/base.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_actions/support.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/models.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/document.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/document_statuses.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/file.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/remote_device.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/models/response_model.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/utils/__init__.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/utils/logger.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk/utils/save_artifact.py +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk_sdk.egg-info/SOURCES.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk_sdk.egg-info/dependency_links.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk_sdk.egg-info/requires.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/clerk_sdk.egg-info/top_level.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/pyproject.toml +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/requirements.txt +0 -0
- {clerk_sdk-0.2.2 → clerk_sdk-0.2.5}/setup.cfg +0 -0
|
@@ -24,8 +24,12 @@ global_ws: Union[ClientConnection, None] = None
|
|
|
24
24
|
clerk_client = RPAClerk()
|
|
25
25
|
wss_uri = "wss://agent-manager.f-one.group/action"
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
REMOTE_DEVICE_ALLOCATION_TIMEOUT = int(
|
|
28
|
+
os.getenv("REMOTE_DEVICE_ALLOCATION_TIMEOUT", 60)
|
|
29
|
+
)
|
|
30
|
+
REMOTE_DEVICE_ALLOCATION_MAX_TRIES = int(
|
|
31
|
+
os.getenv("REMOTE_DEVICE_ALLOCATION_MAX_TRIES", 60)
|
|
32
|
+
)
|
|
29
33
|
|
|
30
34
|
|
|
31
35
|
def _allocate_remote_device(
|
|
@@ -46,14 +50,14 @@ def _allocate_remote_device(
|
|
|
46
50
|
|
|
47
51
|
except NoClientsAvailable:
|
|
48
52
|
logger.warning(
|
|
49
|
-
f"No clients are available for {group_name} group. Initiating a {
|
|
53
|
+
f"No clients are available for {group_name} group. Initiating a {REMOTE_DEVICE_ALLOCATION_TIMEOUT} seconds wait. Retry count: {retries}"
|
|
50
54
|
)
|
|
51
|
-
retries
|
|
52
|
-
if retries == MAX_CLIENT_AVAILABILITY_RETRIES:
|
|
55
|
+
if retries >= REMOTE_DEVICE_ALLOCATION_MAX_TRIES:
|
|
53
56
|
raise ClientAvailabilityTimeout(
|
|
54
|
-
f"No clients available for {group_name} group after {
|
|
57
|
+
f"No clients available for {group_name} group after {REMOTE_DEVICE_ALLOCATION_TIMEOUT * REMOTE_DEVICE_ALLOCATION_MAX_TRIES} seconds"
|
|
55
58
|
)
|
|
56
|
-
time.sleep(
|
|
59
|
+
time.sleep(REMOTE_DEVICE_ALLOCATION_TIMEOUT)
|
|
60
|
+
retries += 1
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
def _deallocate_target(
|
|
@@ -65,7 +69,9 @@ def _deallocate_target(
|
|
|
65
69
|
os.environ.pop("REMOTE_DEVICE_NAME", None)
|
|
66
70
|
|
|
67
71
|
|
|
68
|
-
def gui_automation(
|
|
72
|
+
def gui_automation(
|
|
73
|
+
reserve_client: bool = False,
|
|
74
|
+
):
|
|
69
75
|
"""
|
|
70
76
|
Decorator that:
|
|
71
77
|
• Allocates a remote device,
|
|
@@ -88,6 +94,7 @@ def gui_automation():
|
|
|
88
94
|
@functools.wraps(func)
|
|
89
95
|
def wrapper(payload: ClerkCodePayload, *args, **kwargs):
|
|
90
96
|
global global_ws
|
|
97
|
+
force_deallocate = False
|
|
91
98
|
os.environ["PROC_ID"] = payload.run_id
|
|
92
99
|
|
|
93
100
|
remote_device = _allocate_remote_device(
|
|
@@ -116,9 +123,11 @@ def gui_automation():
|
|
|
116
123
|
|
|
117
124
|
except Exception as e:
|
|
118
125
|
os.environ.pop("PROC_ID", None)
|
|
126
|
+
force_deallocate = True
|
|
119
127
|
raise
|
|
120
128
|
finally:
|
|
121
|
-
|
|
129
|
+
if not reserve_client or force_deallocate:
|
|
130
|
+
_deallocate_target(clerk_client, remote_device, payload.run_id)
|
|
122
131
|
|
|
123
132
|
if global_ws and global_ws.state is State.OPEN:
|
|
124
133
|
close_task = event_loop.create_task(close_ws_connection(global_ws))
|
|
@@ -13,7 +13,7 @@ gui_requirements = get_requirements("./clerk/gui_automation")
|
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="clerk-sdk",
|
|
16
|
-
version="0.2.
|
|
16
|
+
version="0.2.5",
|
|
17
17
|
description="Library for interacting with Clerk",
|
|
18
18
|
long_description=open("README.md").read(),
|
|
19
19
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|