Skip to content
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

Integration fixes #33

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/notebook_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class NotebookData(BaseModel):
cell_index: int
kernel: str
notebook: Notebook
save: bool
user_name: str | None = None
base_image_name: str | None = None

Expand Down
1 change: 0 additions & 1 deletion app/models/workflow_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Cell(BaseModel):
secrets: Optional[list[dict]] | None = None
confs: Optional[list[dict]] | None = None
dependencies: Optional[list[dict]] | None = None
chart_obj: dict | None = None
kernel: Literal['python', 'IRkernel', 'ipython', 'c']
original_source: str
source_url: Optional[str] | None = None
Expand Down
31 changes: 0 additions & 31 deletions app/services/cell_extractor/extractor.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import abc
import hashlib
import json
import re

from slugify import slugify

from app.models.notebook_data import NotebookData
from app.models.workflow_cell import Cell
from app.services.base_image.base_image_tags import BaseImageTags
from app.services.converter.converter import ConverterReactFlowChart


class Extractor(abc.ABC):
Expand Down Expand Up @@ -41,33 +38,6 @@ def get_cell(self) -> Cell:
title = slugify(title) if title and title[0] == "#" else "Untitled"
title += '-' + slugify(self.user_name)
title = title.lower()
cell_identity_dict = {
'title': title,
'params': self.cell_params,
'secrets': self.cell_secrets,
'inputs': self.cell_inputs,
'outputs': self.cell_outputs,
}
cell_identity_str = json.dumps(cell_identity_dict, sort_keys=True)
node_id = hashlib.sha1(cell_identity_str.encode()).hexdigest()[:7]
node = ConverterReactFlowChart.get_node(
title,
self.cell_inputs,
self.cell_outputs,
self.cell_params,
self.cell_secrets,
)
chart = {
'offset': {
'x': 0,
'y': 0,
},
'scale': 1,
'nodes': {node_id: node},
'links': {},
'selected': {},
'hovered': {},
}
base_image_tags = BaseImageTags(self.base_image_tags_url)
cell_dict = {
'title': title,
Expand All @@ -79,7 +49,6 @@ def get_cell(self) -> Cell:
'dependencies': self.cell_dependencies,
'base_container_image':
base_image_tags.base_image_tags[self.base_image_name],
'chart_obj': chart,
'kernel': self.kernel,
'original_source': self.clean_code()
}
Expand Down
Empty file removed app/services/converter/__init__.py
Empty file.
180 changes: 0 additions & 180 deletions app/services/converter/converter.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -147,53 +147,6 @@
"base_image_name": "r"
},
"cell": {
"chart_obj": {
"hovered": {},
"links": {},
"nodes": {
"a62fe24": {
"id": "a62fe24",
"ports": {
"count": {
"id": "count",
"properties": {
"color": "#783d3a"
},
"type": "left"
}
},
"position": {
"x": 35,
"y": 15
},
"properties": {
"inputs": [
"count"
],
"og_node_id": "a62fe24",
"outputs": [],
"params": [],
"secrets": [],
"title": "add1-r-test-user-2",
"vars": [
{
"color": "#783d3a",
"direction": "input",
"name": "count",
"type": "datatype"
}
]
},
"type": "input-output"
}
},
"offset": {
"x": 0,
"y": 0
},
"scale": 1,
"selected": {}
},
"confs": [],
"dependencies": [],
"inputs": [
Expand All @@ -213,4 +166,4 @@
"runtime": "ghcr.io/qcdis/naavre/naavre-cell-runtime-r:v0.21.1"
}
}
}
}
64 changes: 1 addition & 63 deletions app/tests/resources/notebook_cells/add1-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,68 +175,6 @@
}
},
"cell": {
"chart_obj": {
"hovered": {},
"links": {},
"nodes": {
"c7a7c9b": {
"id": "c7a7c9b",
"ports": {
"a": {
"id": "a",
"properties": {
"color": "#77862d"
},
"type": "right"
},
"count": {
"id": "count",
"properties": {
"color": "#783d3a"
},
"type": "left"
}
},
"position": {
"x": 35,
"y": 15
},
"properties": {
"inputs": [
"count"
],
"og_node_id": "c7a7c9b",
"outputs": [
"a"
],
"params": [],
"secrets": [],
"title": "add1-test-user-2",
"vars": [
{
"color": "#783d3a",
"direction": "input",
"name": "count",
"type": "datatype"
},
{
"color": "#77862d",
"direction": "output",
"name": "a",
"type": "datatype"
}
]
},
"type": "input-output"
}
},
"offset": {
"x": 0,
"y": 0
},
"scale": 1,
"selected": {}
},
"confs": [],
"dependencies": [],
"inputs": [
Expand All @@ -261,4 +199,4 @@
"runtime": "ghcr.io/qcdis/naavre/naavre-cell-runtime-python:v0.21.1"
}
}
}
}
Loading
Loading