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

Bachelorarbeit 2024 #199

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
104 changes: 104 additions & 0 deletions examples/workflow_editor_gui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Interactive workflow creation"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import geoengine as ge"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"ge.initialize(\"http://localhost:3030/api\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Display editor GUI"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "65051802c71c4c968d156b5a9280e7d2",
"version_major": 2,
"version_minor": 1
},
"text/plain": [
"WorkflowEditor(serverUrl='http://localhost:3030/api', token='2f91e7ea-90a0-4ac8-860e-7119d32efe25')"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"editor = ge.create_workflow_editor()\n",
"editor"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'type': 'Raster',\n",
" 'operator': {'type': 'GdalSource', 'params': {'data': 'test'}}}"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"editor.workflow"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "env",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
2 changes: 1 addition & 1 deletion geoengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
FeatureDataType, RasterBandDescriptor, DEFAULT_ISO_TIME_FORMAT, RasterColorizer, SingleBandRasterColorizer \

from .util import clamp_datetime_ms_ns
from .workflow import WorkflowId, Workflow, workflow_by_id, register_workflow, get_quota, update_quota
from .workflow import WorkflowId, Workflow, workflow_by_id, register_workflow, get_quota, update_quota, create_workflow_editor
from .raster import RasterTile2D

from . import workflow_builder
Expand Down
7 changes: 7 additions & 0 deletions geoengine/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from geoengine.tasks import Task, TaskId
from geoengine.workflow_builder.operators import Operator as WorkflowBuilderOperator
from geoengine.raster import RasterTile2D
from workflow_editor import WorkflowEditor


# TODO: Define as recursive type when supported in mypy: https://github.com/python/mypy/issues/731
Expand Down Expand Up @@ -958,3 +959,9 @@ def update_quota(user_id: UUID, new_available_quota: int, timeout: int = 60) ->
),
_request_timeout=timeout
)


def create_workflow_editor() -> WorkflowEditor:
session = get_session()

return WorkflowEditor(session.server_url, session.configuration.access_token)
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package_dir =
packages = find:
python_requires = >=3.8
install_requires =
workflow-editor @ git+https://github.com/1lutz/workflow-editor.git
geoengine-openapi-client == 0.0.4
geopandas >=0.9,<0.15
matplotlib >=3.5,<3.8
Expand Down