Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7517682456 | |||
| 46b6c0d68c | |||
| 62d5e67bab | |||
| dee3ff2b63 | |||
| 9f1aa11551 | |||
| b538e6d8d3 | |||
| 81365c0e5a |
Generated
+12
-1
@@ -1616,6 +1616,17 @@ h2 = ["h2 (>=4,<5)"]
|
||||
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
zstd = ["zstandard (>=0.18.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "vulture"
|
||||
version = "2.11"
|
||||
description = "Find dead code"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "vulture-2.11-py2.py3-none-any.whl", hash = "sha256:12d745f7710ffbf6aeb8279ba9068a24d4e52e8ed333b8b044035c9d6b823aba"},
|
||||
{file = "vulture-2.11.tar.gz", hash = "sha256:f0fbb60bce6511aad87ee0736c502456737490a82d919a44e6d92262cb35f1c2"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "websockets"
|
||||
version = "11.0.3"
|
||||
@@ -1880,4 +1891,4 @@ multidict = ">=4.0"
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "fa9a19381de95ee7cd6798a3b4707ed3fbe2f2845e449cdcd652d5670e4038cf"
|
||||
content-hash = "d8792ab3203910f2a054288ebb3e8d05e1deca69549c2fdf475aa7ffd2878b40"
|
||||
|
||||
+7
-6
@@ -8,18 +8,19 @@ packages = [{ include = "src" }]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
matplotlib = "^3.8.0"
|
||||
matplotlib = "^3.9.1"
|
||||
seaborn = "^0.13.0"
|
||||
reportlab = "^4.0.6"
|
||||
reportlab = "^4.2.2"
|
||||
mypy = "^1.11.1"
|
||||
pydantic = "^2.8.2"
|
||||
specklepy = "^2.19.5"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
black = "^23.3.0"
|
||||
black = "^23.12.1"
|
||||
ruff = "^0.0.271"
|
||||
pytest = "^7.4.2"
|
||||
python-dotenv = "^1.0.0"
|
||||
pytest = "^7.4.4"
|
||||
python-dotenv = "^1.0.1"
|
||||
vulture = "^2.11"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
@@ -36,4 +37,4 @@ select = [
|
||||
]
|
||||
|
||||
[tool.ruff.pydocstyle]
|
||||
convention = "google"
|
||||
convention = "google"
|
||||
|
||||
@@ -9,5 +9,9 @@ sys.path.append(str(src_path))
|
||||
from src.main import automate_function, FunctionInputs
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("---------")
|
||||
print("| BEGIN |")
|
||||
print("---------")
|
||||
|
||||
# Entry point: Execute the automate function with defined inputs.
|
||||
execute_automate_function(automate_function, FunctionInputs)
|
||||
|
||||
+6
-10
@@ -1,8 +1,7 @@
|
||||
from pydantic import Field
|
||||
from speckle_automate import (
|
||||
AutomateBase,
|
||||
AutomationContext,
|
||||
execute_automate_function,
|
||||
AutomationContext
|
||||
)
|
||||
|
||||
from objects.objects import (
|
||||
@@ -12,7 +11,7 @@ from objects.objects import (
|
||||
density_summary,
|
||||
transport_recolorized_commit
|
||||
)
|
||||
from src.utilities.reporting import generate_pdf, write_pdf_to_temp, generate_summary
|
||||
from src.utilities.reporting import generate_pdf, write_pdf_to_temp, generate_summary, safe_store_file_result
|
||||
from src.utilities.utilities import filter_displayable_bases
|
||||
|
||||
class FunctionInputs(AutomateBase):
|
||||
@@ -74,11 +73,6 @@ def automate_function(
|
||||
automate_context, health_objects, function_inputs.density_level
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
colorise_densities(automate_context, health_objects)
|
||||
|
||||
# Wrap up the analysis by marking the run either successful or failed.
|
||||
@@ -114,9 +108,11 @@ def automate_function(
|
||||
|
||||
file_name = write_pdf_to_temp(report)
|
||||
|
||||
print(commit_details["server_url"])
|
||||
print("------------------------------------------------")
|
||||
print(f"| {commit_details['server_url']} |")
|
||||
print("------------------------------------------------")
|
||||
|
||||
automate_context.store_file_result(file_name)
|
||||
safe_store_file_result(automate_context, file_name)
|
||||
|
||||
# colorise the objects that pass/fail and send to a new model version
|
||||
transport_recolorized_commit(
|
||||
|
||||
+12
-1
@@ -404,6 +404,17 @@ def density_summary(
|
||||
|
||||
return data, all_densities, all_areas
|
||||
|
||||
def find_density_branch(automation_context: AutomationContext) -> Optional[Base]:
|
||||
client = automation_context.speckle_client
|
||||
project_id = automation_context.automation_run_data.project_id
|
||||
|
||||
branches = client.branch.list(project_id, 100, 0)
|
||||
for branch in branches:
|
||||
if "density" in branch.name.lower():
|
||||
print(f"Found 'density' branch: {branch.name}, Branch ID: {branch.id}")
|
||||
return branch.id
|
||||
print("No branch with the name 'density' found.")
|
||||
return None
|
||||
|
||||
def transport_recolorized_commit(
|
||||
automate_context: AutomationContext,
|
||||
@@ -414,7 +425,7 @@ def transport_recolorized_commit(
|
||||
# return the commit id of the new commit
|
||||
# create a new commit on a specific branch - we'll use "dirstat" for now
|
||||
|
||||
if automate_context.automation_run_data.branch_name == "density":
|
||||
if find_density_branch(automate_context) is not None:
|
||||
# commits on the density branch cannot be recolored
|
||||
print("------------------------------------------------")
|
||||
print("| CANNOT RECOLOR COMMITS ON THE DENSITY BRANCH |")
|
||||
|
||||
@@ -276,14 +276,14 @@ def safe_store_file_result(automate_context: AutomationContext, file_name: str):
|
||||
# Attempt to store the file
|
||||
automate_context.store_file_result(file_name)
|
||||
except httpx.HTTPStatusError as e:
|
||||
if e.response.status_code == 404:
|
||||
if e.response.status_code != 404:
|
||||
raise
|
||||
|
||||
else:
|
||||
# Handle the 404 error
|
||||
error_message = f"Unable to store file: {file_name}. Error: {str(e)}"
|
||||
print(error_message) # For logging purposes
|
||||
automate_context.mark_run_exception(error_message)
|
||||
|
||||
else:
|
||||
raise
|
||||
# automate_context.mark_run_exception(error_message)
|
||||
finally:
|
||||
# Restore the original URL
|
||||
automate_context.automation_run_data.speckle_server_url = original_url
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import List, TypeVar, Iterable, Optional
|
||||
|
||||
from specklepy.objects.base import Base
|
||||
|
||||
from flatten import extract_base_and_transform
|
||||
from src.utilities.flatten import extract_base_and_transform
|
||||
|
||||
T = TypeVar("T", bound=Base)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user