Skip to content

Commit 310e159

Browse files
Update linting rules
1 parent cc5b83c commit 310e159

409 files changed

Lines changed: 3321 additions & 5259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141

4242
unit-test:
4343
runs-on: ubuntu-latest
44+
needs: lint-code
4445
env:
4546
COVERAGE_FILE: coverage.xml
4647
COVERAGE_DIR: .coverage-reports

.pre-commit-config.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# Global exclusions for generated code
2+
exclude: |
3+
(?x)^(src/conductor/client/http/|src/conductor/client/codegen/|src/conductor/client/orkes/api/|src/conductor/asyncio_client/http/)
4+
15
repos:
26
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
7+
rev: v6.0.0
48
hooks:
59
- id: trailing-whitespace
610
- id: end-of-file-fixer
@@ -20,14 +24,14 @@ repos:
2024
- id: poetry-check
2125
- id: poetry-lock
2226

23-
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.15.0
25-
hooks:
26-
- id: mypy
27-
pass_filenames: false
27+
# - repo: https://github.com/pre-commit/mirrors-mypy
28+
# rev: v1.15.0
29+
# hooks:
30+
# - id: mypy
31+
# pass_filenames: false
2832

2933
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.9.7
34+
rev: v0.12.3
3135
hooks:
3236
- id: ruff
3337
args:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,22 @@ def main():
120120
# Connect to Conductor server
121121
api_config = Configuration()
122122
workflow_executor = WorkflowExecutor(configuration=api_config)
123-
123+
124124
# Register and create workflow
125125
workflow = greetings_workflow(workflow_executor)
126126
workflow.register(True)
127-
127+
128128
# Start workers
129129
task_handler = TaskHandler(configuration=api_config)
130130
task_handler.start_processes()
131-
131+
132132
# Execute workflow
133133
workflow_run = workflow_executor.execute(
134-
name=workflow.name,
134+
name=workflow.name,
135135
version=workflow.version,
136136
workflow_input={'name': 'Orkes'}
137137
)
138-
138+
139139
print(f'Workflow result: {workflow_run.output["result"]}')
140140
task_handler.stop_processes()
141141

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ This is the final step that triggers the deployment pipeline.
8585

8686
- Pushing the tag will trigger the "Release" workflow in GitHub Actions.
8787
- Monitor the workflow to ensure it completes successfully.
88-
- Once the workflow is finished, navigate to the project's page on [PyPI](https://pypi.org/project/conductor-python/) to verify that the new version has been published.
88+
- Once the workflow is finished, navigate to the project's page on [PyPI](https://pypi.org/project/conductor-python/) to verify that the new version has been published.

conductor_apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ Here is a recommended approach when defining workflows using JSON:
7878
A powerful feature of Conductor is the ability to version workflows. You should increment the version of the workflow when there is a significant change to the definition. You can run multiple versions of the workflow at the same time. When starting a new workflow execution, use the `version` field to specify which version to use. When omitted, the latest (highest-numbered) version is used.
7979

8080
* Versioning allows safely testing changes by doing canary testing in production or A/B testing across multiple versions before rolling out.
81-
* A version can also be deleted, effectively allowing for "rollback" if required.
81+
* A version can also be deleted, effectively allowing for "rollback" if required.

docs/authentication-retry-policy.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ async def main():
146146
auth_401_max_attempts=3,
147147
auth_401_base_delay_ms=500.0
148148
)
149-
149+
150150
workflow_client = WorkflowClient(config)
151-
151+
152152
# The retry policy is automatically applied to all API calls
153153
workflow = await workflow_client.start_workflow(
154154
name="my_workflow",
155155
version=1,
156156
input={"key": "value"}
157157
)
158-
158+
159159
print(f"Started workflow: {workflow.workflow_id}")
160160

161161
asyncio.run(main())
@@ -203,17 +203,17 @@ async def start_multiple_workflows():
203203
auth_key="your_key",
204204
auth_secret="your_secret"
205205
)
206-
206+
207207
workflow_client = WorkflowClient(config)
208-
208+
209209
# Start multiple workflows concurrently
210210
# If all receive 401, only one token refresh will occur
211211
tasks = [
212212
workflow_client.start_workflow(name="workflow1", version=1, input={}),
213213
workflow_client.start_workflow(name="workflow2", version=1, input={}),
214214
workflow_client.start_workflow(name="workflow3", version=1, input={})
215215
]
216-
216+
217217
results = await asyncio.gather(*tasks)
218218
return results
219219

docs/configuration/proxy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ async def main():
193193
"https://": "http://proxy.company.com:8080"
194194
}
195195
)
196-
196+
197197
config = Configuration(
198198
server_url="https://api.orkes.io/api",
199199
http_connection=async_client
200200
)
201-
201+
202202
async with ApiClient(config) as api_client:
203203
# Use the client with proxy configuration
204204
pass

docs/configuration/ssl-tls.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import ssl
7777
ssl_context = ssl.create_default_context()
7878
ssl_context.load_verify_locations("/path/to/ca-certificate.pem")
7979
ssl_context.load_cert_chain(
80-
certfile="/path/to/client-certificate.pem",
80+
certfile="/path/to/client-certificate.pem",
8181
keyfile="/path/to/client-key.pem"
8282
)
8383

@@ -113,7 +113,7 @@ async def main():
113113
async with ApiClient(config) as api_client:
114114
orkes_clients = OrkesClients(api_client, config)
115115
workflow_client = orkes_clients.get_workflow_client()
116-
116+
117117
# Use the client with SSL configuration
118118
workflows = await workflow_client.search_workflows()
119119
print(f"Found {len(workflows)} workflows")
@@ -144,7 +144,7 @@ import ssl
144144
ssl_context = ssl.create_default_context()
145145
ssl_context.load_verify_locations("/path/to/ca-certificate.pem")
146146
ssl_context.load_cert_chain(
147-
certfile="/path/to/client-certificate.pem",
147+
certfile="/path/to/client-certificate.pem",
148148
keyfile="/path/to/client-key.pem"
149149
)
150150
ssl_context.check_hostname = True
@@ -251,7 +251,7 @@ import socket
251251
def test_ssl_connection(hostname, port, ca_cert_path):
252252
context = ssl.create_default_context()
253253
context.load_verify_locations(ca_cert_path)
254-
254+
255255
with socket.create_connection((hostname, port)) as sock:
256256
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
257257
print(f"SSL connection successful: {ssock.version()}")

docs/development/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Both guides include detailed troubleshooting sections, best practices, and step-
7979
```bash
8080
# For sync client
8181
python scripts/generate_swagger.py --version 3.15.0 --output src/conductor/client/swagger.json
82-
82+
8383
# For async client
8484
python scripts/generate_swagger.py --version 3.15.0 --output src/conductor/asyncio_client/swagger.json
8585
```
@@ -88,7 +88,7 @@ Both guides include detailed troubleshooting sections, best practices, and step-
8888
```bash
8989
# Sync client
9090
swagger-codegen generate -i src/conductor/client/swagger.json -l python -o src/conductor/client/codegen/
91-
91+
9292
# Async client
9393
openapi-generator generate -i src/conductor/asyncio_client/swagger.json -g python -o src/conductor/asyncio_client/http/
9494
```
@@ -150,7 +150,7 @@ def test_worker_task_execution():
150150
@worker_task(task_definition_name='test_task')
151151
def test_task(input_data: str) -> str:
152152
return f"processed: {input_data}"
153-
153+
154154
result = test_task("test_input")
155155
assert result == "processed: test_input"
156156
```

docs/development/workflow_usage_examples.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ print(not_found) # None
159159
```python
160160
def monitor_workflow_status(workflow: Workflow):
161161
"""Monitor and report workflow status"""
162-
162+
163163
if workflow.is_completed():
164164
if workflow.is_successful():
165165
print("Workflow completed successfully!")
@@ -169,16 +169,16 @@ def monitor_workflow_status(workflow: Workflow):
169169
return "FAILED"
170170
elif workflow.is_running():
171171
print("Workflow is still running...")
172-
172+
173173
# Check current task
174174
current = workflow.current_task
175175
if current:
176176
print(f"Current task: {current.task_def_name} ({current.status})")
177-
177+
178178
# Get all in-progress tasks
179179
in_progress = workflow.get_in_progress_tasks()
180180
print(f"Total in-progress tasks: {len(in_progress)}")
181-
181+
182182
return "RUNNING"
183183
else:
184184
print("Unknown workflow status")
@@ -194,16 +194,16 @@ status = monitor_workflow_status(workflow)
194194
```python
195195
def track_task_progress(workflow: Workflow):
196196
"""Track progress of specific tasks in a workflow"""
197-
197+
198198
# Get all in-progress tasks
199199
in_progress_tasks = workflow.get_in_progress_tasks()
200-
200+
201201
print(f"Workflow Status: {workflow.status}")
202202
print(f"Total in-progress tasks: {len(in_progress_tasks)}")
203-
203+
204204
for task in in_progress_tasks:
205205
print(f"- {task.task_def_name}: {task.status}")
206-
206+
207207
# If task has a reference name, show it
208208
if hasattr(task, 'workflow_task') and task.workflow_task:
209209
ref_name = getattr(task.workflow_task, 'task_reference_name', 'N/A')
@@ -219,39 +219,39 @@ track_task_progress(workflow)
219219
```python
220220
def process_workflow_result(workflow: Workflow):
221221
"""Process workflow results based on completion status"""
222-
222+
223223
if not workflow.is_completed():
224224
print("Workflow is not yet completed")
225225
return None
226-
226+
227227
if workflow.is_successful():
228228
print("Processing successful workflow result...")
229-
229+
230230
# Get workflow output
231231
if workflow.output:
232232
print(f"Workflow output: {workflow.output}")
233-
233+
234234
# Find specific tasks by reference name
235235
result_task = workflow.get_task_by_reference_name("process_result")
236236
if result_task:
237237
print(f"Result task status: {result_task.status}")
238238
if hasattr(result_task, 'output_data') and result_task.output_data:
239239
print(f"Task output: {result_task.output_data}")
240-
240+
241241
return workflow.output
242-
242+
243243
else:
244244
print("Processing failed workflow...")
245-
245+
246246
# Get failed tasks
247247
failed_tasks = [task for task in workflow.tasks if task.status == "FAILED"]
248248
print(f"Number of failed tasks: {len(failed_tasks)}")
249-
249+
250250
for task in failed_tasks:
251251
print(f"Failed task: {task.task_def_name}")
252252
if hasattr(task, 'reason_for_incompletion'):
253253
print(f"Reason: {task.reason_for_incompletion}")
254-
254+
255255
return None
256256

257257
# Usage
@@ -264,7 +264,7 @@ result = process_workflow_result(workflow)
264264
```python
265265
def health_check_workflow(workflow: Workflow) -> dict:
266266
"""Perform a comprehensive health check on a workflow"""
267-
267+
268268
health_status = {
269269
"workflow_id": getattr(workflow, 'workflow_id', 'unknown'),
270270
"status": workflow.status,
@@ -276,19 +276,19 @@ def health_check_workflow(workflow: Workflow) -> dict:
276276
"in_progress_count": 0,
277277
"total_tasks": 0
278278
}
279-
279+
280280
# Task information
281281
if workflow.tasks:
282282
health_status["total_tasks"] = len(workflow.tasks)
283283
health_status["in_progress_count"] = len(workflow.get_in_progress_tasks())
284-
284+
285285
current = workflow.current_task
286286
if current:
287287
health_status["current_task"] = {
288288
"name": current.task_def_name,
289289
"status": current.status
290290
}
291-
291+
292292
# Overall health assessment
293293
if workflow.is_successful():
294294
health_status["health"] = "HEALTHY"
@@ -298,7 +298,7 @@ def health_check_workflow(workflow: Workflow) -> dict:
298298
health_status["health"] = "IN_PROGRESS"
299299
else:
300300
health_status["health"] = "UNKNOWN"
301-
301+
302302
return health_status
303303

304304
# Usage
@@ -335,7 +335,7 @@ print(workflow.current_task) # None or current task
335335
```python
336336
def comprehensive_workflow_check(workflow: WorkflowAdapter):
337337
"""Comprehensive workflow state checking"""
338-
338+
339339
if workflow.is_completed():
340340
if workflow.is_successful():
341341
return "SUCCESS"

0 commit comments

Comments
 (0)