Debian Codegraph @

src/globus_sdk/testing/data/timer/_common.py

raw
1 import typing as t
2 import uuid
3
4 TIMER_ID = str(uuid.uuid1())
5
6 DEST_EP_ID = str(uuid.uuid1())
7 SOURCE_EP_ID = str(uuid.uuid1())
8
9
10 V2_TRANSFER_TIMER = {
11 "body": {
12 "DATA": [
13 {
14 "DATA_TYPE": "transfer_item",
15 "destination_path": "/~/dst.txt",
16 "source_path": "/share/godata/file1.txt",
17 }
18 ],
19 "DATA_TYPE": "transfer",
20 "delete_destination_extra": False,
21 "destination_endpoint": DEST_EP_ID,
22 "encrypt_data": False,
23 "fail_on_quota_errors": False,
24 "notify_on_failed": True,
25 "notify_on_inactive": True,
26 "notify_on_succeeded": True,
27 "preserve_timestamp": False,
28 "skip_source_errors": False,
29 "source_endpoint": SOURCE_EP_ID,
30 "store_base_path_info": False,
31 "verify_checksum": True,
32 },
33 "inactive_reason": None,
34 "job_id": TIMER_ID,
35 "last_ran_at": None,
36 "name": "Very Cool Timer",
37 "next_run": "2023-10-27T05:00:00+00:00",
38 "number_of_errors": 0,
39 "number_of_runs": 0,
40 "schedule": {
41 "type": "recurring",
42 "end": {"count": 2},
43 "interval_seconds": 604800,
44 "start": "2023-10-27T05:00:00+00:00",
45 },
46 "status": "new",
47 "submitted_at": "2023-10-26T20:31:09+00:00",
48 "timer_type": "transfer",
49 }
50
51
52 FLOW_ID = str(uuid.uuid4())
53 V2_FLOW_TIMER: dict[str, t.Any] = {
54 "callback_body": {
55 "body": {"input_key": "input_value"},
56 "run_managers": [f"urn:globus:auth:identity:{uuid.uuid4()}"],
57 },
58 "callback_url": f"https://flows.automate.globus.org/flows/{FLOW_ID}/run",
59 "inactive_reason": None,
60 "interval": None,
61 "job_id": str(uuid.uuid4()),
62 "last_ran_at": None,
63 "n_errors": 0,
64 "n_runs": 0,
65 "name": "Very Cool Timer",
66 "next_run": "2025-10-27T05:00:00+00:00",
67 "results": [],
68 "schedule": {
69 "datetime": "2025-10-27T05:00:00+00:00",
70 "type": "once",
71 },
72 "scope": (
73 f"https://auth.globus.org/scopes/{FLOW_ID}"
74 f"/flow_{FLOW_ID.replace('-', '_')}_user"
75 ),
76 "status": "new",
77 "stop_after": {
78 "date": None,
79 "n_runs": 1,
80 },
81 "submitted_at": "2025-08-01T20:31:09+00:00",
82 "timer_type": "flow",
83 }
84
85
86 # V1 API data
87
88 _transfer_data: dict[str, t.Any] = {
89 "data": {
90 "action_id": "15jfdBESgveZQ",
91 "completion_time": "2022-04-01T19:30:05.973261+00:00",
92 "creator_id": "urn:globus:auth:identity:5276fa05-eedf-46c5-919f-ad2d0160d1a9",
93 "details": {
94 "DATA_TYPE": "task",
95 "bytes_checksummed": 0,
96 "bytes_transferred": 0,
97 "canceled_by_admin": None,
98 "canceled_by_admin_message": None,
99 "command": "API 0.10",
100 "completion_time": None,
101 "deadline": "2022-04-02T19:30:07+00:00",
102 "delete_destination_extra": False,
103 "destination_endpoint": "globus#dest_ep",
104 "destination_endpoint_display_name": "Some Dest Endpoint",
105 "destination_endpoint_id": DEST_EP_ID,
106 "directories": 0,
107 "effective_bytes_per_second": 0,
108 "encrypt_data": False,
109 "event_list": [],
110 "fail_on_quota_errors": False,
111 "fatal_error": None,
112 "faults": 0,
113 "files": 0,
114 "files_skipped": 0,
115 "files_transferred": 0,
116 "filter_rules": None,
117 "history_deleted": False,
118 "is_ok": True,
119 "is_paused": False,
120 "label": "example timer, run 1",
121 "nice_status": "Queued",
122 "nice_status_details": None,
123 "nice_status_expires_in": -1,
124 "nice_status_short_description": "Queued",
125 "owner_id": "5276fa05-eedf-46c5-919f-ad2d0160d1a9",
126 "preserve_timestamp": False,
127 "recursive_symlinks": "ignore",
128 "request_time": "2022-04-01T19:30:07+00:00",
129 "skip_source_errors": True,
130 "source_endpoint": "globus#src_ep",
131 "source_endpoint_display_name": "Some Source Endpoint",
132 "source_endpoint_id": SOURCE_EP_ID,
133 "status": "ACTIVE",
134 "subtasks_canceled": 0,
135 "subtasks_expired": 0,
136 "subtasks_failed": 0,
137 "subtasks_pending": 1,
138 "subtasks_retrying": 0,
139 "subtasks_skipped_errors": 0,
140 "subtasks_succeeded": 0,
141 "subtasks_total": 1,
142 "symlinks": 0,
143 "sync_level": 3,
144 "task_id": "22f0148c-b1f2-11ec-b87e-3912f602f346",
145 "type": "TRANSFER",
146 "username": "u_kj3pubpo35dmlem7vuwqcygrve",
147 "verify_checksum": True,
148 },
149 "display_status": "ACTIVE",
150 "label": None,
151 "manage_by": [],
152 "monitor_by": [],
153 "release_after": "P30D",
154 "start_time": "2022-04-01T19:30:05.973232+00:00",
155 "status": "ACTIVE",
156 },
157 "errors": None,
158 "status": 202,
159 "ran_at": "2022-04-01T19:30:07.103090",
160 }
161 V1_TIMER = {
162 "name": "example timer",
163 "start": "2022-04-01T19:30:00+00:00",
164 "stop_after": None,
165 "interval": 864000.0,
166 "callback_url": "https://actions.automate.globus.org/transfer/transfer/run",
167 "callback_body": {
168 "body": {
169 "label": "example timer",
170 "skip_source_errors": True,
171 "sync_level": 3,
172 "verify_checksum": True,
173 "source_endpoint_id": "aa752cea-8222-5bc8-acd9-555b090c0ccb",
174 "destination_endpoint_id": "313ce13e-b597-5858-ae13-29e46fea26e6",
175 "transfer_items": [
176 {
177 "source_path": "/share/godata/file1.txt",
178 "destination_path": "/~/file1.txt",
179 "recursive": False,
180 }
181 ],
182 }
183 },
184 "inactive_reason": None,
185 "scope": None,
186 "job_id": TIMER_ID,
187 "status": "loaded",
188 "submitted_at": "2022-04-01T19:29:55.942546+00:00",
189 "last_ran_at": "2022-04-01T19:30:07.103090+00:00",
190 "next_run": "2022-04-11T19:30:00+00:00",
191 "n_runs": 1,
192 "n_errors": 0,
193 "results": {"data": [_transfer_data], "page_next": None},
194 }