shu/autoupgrade pre commit (#1553)
This commit is contained in:
@@ -15,7 +15,7 @@ repos:
|
|||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.7.3
|
rev: v0.9.1
|
||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
@@ -37,7 +37,7 @@ repos:
|
|||||||
- id: python-use-type-annotations
|
- id: python-use-type-annotations
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.13.0
|
rev: v1.14.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
args: [--show-error-codes, --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --python-version=3.11]
|
args: [--show-error-codes, --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --python-version=3.11]
|
||||||
|
|||||||
@@ -1080,7 +1080,7 @@ async def validate_file_size(file: UploadFile) -> UploadFile:
|
|||||||
if size > app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE:
|
if size > app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=413,
|
status_code=413,
|
||||||
detail=f"File size exceeds the maximum allowed size ({app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE/1024/1024} MB)",
|
detail=f"File size exceeds the maximum allowed size ({app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE / 1024 / 1024} MB)",
|
||||||
)
|
)
|
||||||
return file
|
return file
|
||||||
|
|
||||||
|
|||||||
@@ -789,7 +789,7 @@ class ForLoopBlock(Block):
|
|||||||
def get_loop_over_parameter_values(self, workflow_run_context: WorkflowRunContext) -> list[Any]:
|
def get_loop_over_parameter_values(self, workflow_run_context: WorkflowRunContext) -> list[Any]:
|
||||||
# parse the value from self.loop_variable_reference and then from self.loop_over
|
# parse the value from self.loop_variable_reference and then from self.loop_over
|
||||||
if self.loop_variable_reference:
|
if self.loop_variable_reference:
|
||||||
value_template = f'{{{{ {self.loop_variable_reference.strip(" {}")} | tojson }}}}'
|
value_template = f"{{{{ {self.loop_variable_reference.strip(' {}')} | tojson }}}}"
|
||||||
try:
|
try:
|
||||||
value_json = self.format_block_parameter_template_from_workflow_run_context(
|
value_json = self.format_block_parameter_template_from_workflow_run_context(
|
||||||
value_template, workflow_run_context
|
value_template, workflow_run_context
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class WorkflowService:
|
|||||||
workflow_run_id, parameters, organization
|
workflow_run_id, parameters, organization
|
||||||
)
|
)
|
||||||
LOG.info(
|
LOG.info(
|
||||||
f"Executing root block {block.block_type} at index {block_idx}/{blocks_cnt -1} for workflow run {workflow_run_id}",
|
f"Executing root block {block.block_type} at index {block_idx}/{blocks_cnt - 1} for workflow run {workflow_run_id}",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -265,7 +265,7 @@ class WorkflowService:
|
|||||||
)
|
)
|
||||||
if block_result.status == BlockStatus.canceled:
|
if block_result.status == BlockStatus.canceled:
|
||||||
LOG.info(
|
LOG.info(
|
||||||
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was canceled for workflow run {workflow_run_id}, cancelling workflow run",
|
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was canceled for workflow run {workflow_run_id}, cancelling workflow run",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -286,7 +286,7 @@ class WorkflowService:
|
|||||||
return workflow_run
|
return workflow_run
|
||||||
elif block_result.status == BlockStatus.failed:
|
elif block_result.status == BlockStatus.failed:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed for workflow run {workflow_run_id}",
|
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed for workflow run {workflow_run_id}",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -295,7 +295,7 @@ class WorkflowService:
|
|||||||
block_label=block.label,
|
block_label=block.label,
|
||||||
)
|
)
|
||||||
if not block.continue_on_failure:
|
if not block.continue_on_failure:
|
||||||
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed. failure reason: {block_result.failure_reason}"
|
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed. failure reason: {block_result.failure_reason}"
|
||||||
await self.mark_workflow_run_as_failed(
|
await self.mark_workflow_run_as_failed(
|
||||||
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
||||||
)
|
)
|
||||||
@@ -309,7 +309,7 @@ class WorkflowService:
|
|||||||
return workflow_run
|
return workflow_run
|
||||||
|
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed but will continue executing the workflow run {workflow_run_id}",
|
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed but will continue executing the workflow run {workflow_run_id}",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -321,7 +321,7 @@ class WorkflowService:
|
|||||||
|
|
||||||
elif block_result.status == BlockStatus.terminated:
|
elif block_result.status == BlockStatus.terminated:
|
||||||
LOG.info(
|
LOG.info(
|
||||||
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was terminated for workflow run {workflow_run_id}, marking workflow run as terminated",
|
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was terminated for workflow run {workflow_run_id}, marking workflow run as terminated",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -331,7 +331,7 @@ class WorkflowService:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not block.continue_on_failure:
|
if not block.continue_on_failure:
|
||||||
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} terminated. Reason: {block_result.failure_reason}"
|
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} terminated. Reason: {block_result.failure_reason}"
|
||||||
await self.mark_workflow_run_as_terminated(
|
await self.mark_workflow_run_as_terminated(
|
||||||
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
||||||
)
|
)
|
||||||
@@ -345,7 +345,7 @@ class WorkflowService:
|
|||||||
return workflow_run
|
return workflow_run
|
||||||
|
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was terminated for workflow run {workflow_run_id}, but will continue executing the workflow run",
|
f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was terminated for workflow run {workflow_run_id}, but will continue executing the workflow run",
|
||||||
block_type=block.block_type,
|
block_type=block.block_type,
|
||||||
workflow_run_id=workflow_run.workflow_run_id,
|
workflow_run_id=workflow_run.workflow_run_id,
|
||||||
block_idx=block_idx,
|
block_idx=block_idx,
|
||||||
@@ -368,7 +368,7 @@ class WorkflowService:
|
|||||||
if isinstance(e, SkyvernException):
|
if isinstance(e, SkyvernException):
|
||||||
exception_message = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"
|
exception_message = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"
|
||||||
|
|
||||||
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed. failure reason: {exception_message}"
|
failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed. failure reason: {exception_message}"
|
||||||
await self.mark_workflow_run_as_failed(
|
await self.mark_workflow_run_as_failed(
|
||||||
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ def json_to_html(element: dict, need_skyvern_attrs: bool = True) -> str:
|
|||||||
and not before_pseudo_text
|
and not before_pseudo_text
|
||||||
and not after_pseudo_text
|
and not after_pseudo_text
|
||||||
):
|
):
|
||||||
return f'<{tag}{attributes_html if not attributes_html else " "+attributes_html}>'
|
return f"<{tag}{attributes_html if not attributes_html else ' ' + attributes_html}>"
|
||||||
else:
|
else:
|
||||||
return f'<{tag}{attributes_html if not attributes_html else " "+attributes_html}>{before_pseudo_text}{text}{children_html+option_html}{after_pseudo_text}</{tag}>'
|
return f"<{tag}{attributes_html if not attributes_html else ' ' + attributes_html}>{before_pseudo_text}{text}{children_html + option_html}{after_pseudo_text}</{tag}>"
|
||||||
|
|
||||||
|
|
||||||
def clean_element_before_hashing(element: dict) -> dict:
|
def clean_element_before_hashing(element: dict) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user