Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 45
Testing 0.0.2#343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Testing 0.0.2 #343
Changes from all commits
dcf8b841fd993154003b38315cf8adb01d81c740b5394a6cfd9584e0eb5d7051f89eafee7af57712235bb8d4536c5d3408File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Ignore temp directory and temp files at repository root | ||
| /temp* | ||
| !/temp/.gitkeep |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| version = "0.0.2b3" | ||
| version = "0.0.2b4" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -141,13 +141,13 @@ def _get_executed_endpoint(self, state_id: str): | ||
| """ | ||
| Construct the endpoint URL for notifying executed states. | ||
| """ | ||
| return f"{self._state_manager_uri}/{str(self._state_manager_version)}/namespace/{self._namespace}/states/{state_id}/executed" | ||
| return f"{self._state_manager_uri}/{str(self._state_manager_version)}/namespace/{self._namespace}/state/{state_id}/executed" | ||
| def _get_errored_endpoint(self, state_id: str): | ||
| """ | ||
| Construct the endpoint URL for notifying errored states. | ||
| """ | ||
| return f"{self._state_manager_uri}/{str(self._state_manager_version)}/namespace/{self._namespace}/states/{state_id}/errored" | ||
| return f"{self._state_manager_uri}/{str(self._state_manager_version)}/namespace/{self._namespace}/state/{state_id}/errored" | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| def _get_register_endpoint(self): | ||
| """ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,8 +27,11 @@ async def send(self, endpoint: str, key: str): | ||
| Raises: | ||
| Exception: If the HTTP request fails (status code != 200). | ||
| """ | ||
| body = { | ||
| "data": self.data | ||
| } | ||
| async with ClientSession() as session: | ||
| async with session.post(endpoint, json=self.data, headers={"x-api-key": key}) as response: | ||
| async with session.post(endpoint, json=body, headers={"x-api-key": key}) as response: | ||
| if response.status != 200: | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| raise Exception(f"Failed to send prune signal to {endpoint}") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,6 +8,7 @@ | ||
| from app.models.db.run import Run | ||
| from app.models.db.graph_template_model import GraphTemplate | ||
| from app.models.node_template_model import NodeTemplate | ||
| from app.models.dependent_string import DependentString | ||
| import uuid | ||
| logger = LogsManager().get_logger() | ||
| @@ -41,6 +42,30 @@ async def trigger_graph(namespace_name: str, graph_name: str, body: TriggerGraph | ||
| if not graph_template.is_valid(): | ||
| raise HTTPException(status_code=400, detail="Graph template is not valid") | ||
| root = graph_template.get_root_node() | ||
| inputs = construct_inputs(root, body.inputs) | ||
| try: | ||
| for field, value in inputs.items(): | ||
| dependent_string = DependentString.create_dependent_string(value) | ||
| for dependent in dependent_string.dependents.values(): | ||
| if dependent.identifier != "store": | ||
| raise HTTPException(status_code=400, detail=f"Root node can have only store identifier as dependent but got {dependent.identifier}") | ||
| elif dependent.field not in body.store: | ||
| if dependent.field in graph_template.store_config.default_values.keys(): | ||
| dependent_string.set_value(dependent.identifier, dependent.field, graph_template.store_config.default_values[dependent.field]) | ||
| else: | ||
| raise HTTPException(status_code=400, detail=f"Dependent {dependent.field} not found in store for root node {root.identifier}") | ||
| else: | ||
| dependent_string.set_value(dependent.identifier, dependent.field, body.store[dependent.field]) | ||
| inputs[field] = dependent_string.generate_string() | ||
| except Exception as e: | ||
| raise HTTPException(status_code=400, detail=f"Invalid input: {e}") | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| check_required_store_keys(graph_template, body.store) | ||
| @@ -64,16 +89,14 @@ async def trigger_graph(namespace_name: str, graph_name: str, body: TriggerGraph | ||
| if len(new_stores) > 0: | ||
| await Store.insert_many(new_stores) | ||
| root = graph_template.get_root_node() | ||
| new_state = State( | ||
| node_name=root.node_name, | ||
| namespace_name=namespace_name, | ||
| identifier=root.identifier, | ||
| graph_name=graph_name, | ||
| run_id=run_id, | ||
| status=StateStatusEnum.CREATED, | ||
| inputs=construct_inputs(root, body.inputs), | ||
| inputs=inputs, | ||
| outputs={}, | ||
| error=None | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,7 +15,7 @@ async def upsert_graph_template(namespace_name: str, graph_name: str, body: Upse | ||
| GraphTemplate.name == graph_name, | ||
| GraphTemplate.namespace == namespace_name | ||
| ) | ||
| try: | ||
| if graph_template: | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| logger.info( | ||
| @@ -28,7 +28,8 @@ async def upsert_graph_template(namespace_name: str, graph_name: str, body: Upse | ||
| GraphTemplate.nodes: body.nodes, # type: ignore | ||
| GraphTemplate.validation_status: GraphTemplateValidationStatus.PENDING, # type: ignore | ||
| GraphTemplate.validation_errors: [], # type: ignore | ||
| GraphTemplate.retry_policy: body.retry_policy # type: ignore | ||
| GraphTemplate.retry_policy: body.retry_policy, # type: ignore | ||
| GraphTemplate.store_config: body.store_config # type: ignore | ||
| }) | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ) | ||
| @@ -46,7 +47,8 @@ async def upsert_graph_template(namespace_name: str, graph_name: str, body: Upse | ||
| nodes=body.nodes, | ||
| validation_status=GraphTemplateValidationStatus.PENDING, | ||
| validation_errors=[], | ||
| retry_policy=body.retry_policy | ||
| retry_policy=body.retry_policy, | ||
| store_config=body.store_config | ||
| ).set_secrets(body.secrets) | ||
| ) | ||
| except ValueError as e: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -71,7 +71,10 @@ async def verify_inputs(graph_template: GraphTemplate, registered_nodes: list[Re | ||
| for dependent_string in dependent_strings: | ||
| identifier_field_pairs = dependent_string.get_identifier_field() | ||
| for identifier, field in identifier_field_pairs: | ||
| if identifier == "store": | ||
| continue | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| temp_node = graph_template.get_node_by_identifier(identifier) | ||
| if temp_node is None: | ||
| errors.append(f"Node {identifier} does not exist in the graph template") | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.