Skip to content

Commit c792a8a

Browse files
authored
Merge pull request #110 from odtp-org/release0.2.5
Release0.2.5
2 parents 2934cc7 + 0460c3a commit c792a8a

21 files changed

Lines changed: 2497 additions & 1076 deletions

.env.dist.local

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ GITHUB_TOKEN=
2525
# Dashboard parameters
2626
ODTP_DASHBOARD_PORT=
2727
ODTP_DASHBOARD_RELOAD=
28+
29+
# Working directory for user projects
30+
ODTP_PATH=

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Changelog
22

3+
- v0.2.5: Bugs corrections and new features
4+
- Components tags parsing
5+
- CLI compatibility with digital twins and executions names
6+
- GUI user's working directory implementation
7+
- GUI executions improvements
8+
39
- v0.2.4: Feature
410
- Network added to compose so odtp components can use it
511
- Introducing `secrets` compatibility
@@ -16,7 +22,6 @@
1622
- remove data mockup
1723
- environment variables now loaded from the environment
1824

19-
2025
- v.0.2.0: Improvements in database and files management.
2126
- New MongoDB Schema supporting users, digital twins, executions, and steps.
2227
- Setup uses pyproject.toml and set up method changed to poetry
@@ -26,7 +31,6 @@
2631
- S3 uploading of outputs from each component.
2732
- Switch UI from Streamlit to Nicegui
2833

29-
3034
- v.0.1.0: Basic UI
3135
- Streamlit APP with different
3236
- User tagging

odtp/cli/execution.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,24 @@
2020

2121

2222
@app.command()
23-
def prepare(
23+
def prepare(
24+
execution_name: str = typer.Option(
25+
None, "--execution-name", help="Specify the name of the execution"
26+
),
2427
execution_id: str = typer.Option(
25-
..., "--execution-id", help="Specify the ID of the execution"
28+
None, "--execution-id", help="Specify the ID of the execution"
2629
),
2730
project_path: str = typer.Option(
2831
..., "--project-path", help="Specify the path for the execution"
2932
),
3033
):
3134
try:
35+
if execution_id is None and execution_name is None:
36+
raise typer.Exit("Please provide either --execution-name or --execution-id")
37+
38+
if execution_name:
39+
execution_id = db.get_document_id_by_field_value("title", execution_name, "executions")
40+
3241
execution = db.get_document_by_id(
3342
document_id=execution_id,
3443
collection=db.collection_executions
@@ -46,8 +55,11 @@ def prepare(
4655

4756
@app.command()
4857
def run(
58+
execution_name: str = typer.Option(
59+
None, "--execution-name", help="Specify the name of the execution"
60+
),
4961
execution_id: str = typer.Option(
50-
..., "--execution-id", help="Specify the ID of the execution"
62+
None, "--execution-id", help="Specify the ID of the execution"
5163
),
5264
project_path: str = typer.Option(
5365
..., "--project-path", help="Specify the path for the execution"
@@ -57,12 +69,18 @@ def run(
5769
)] = None,
5870
):
5971
try:
72+
if execution_id is None and execution_name is None:
73+
raise typer.Exit("Please provide either --execution-name or --execution-id")
74+
75+
if execution_name:
76+
execution_id = db.get_document_id_by_field_value("title", execution_name, "executions")
77+
6078
execution = db.get_document_by_id(
6179
document_id=execution_id,
6280
collection=db.collection_executions
6381
)
6482
step_count = len(execution["workflowSchema"]["workflowExecutorSchema"])
65-
secrets = odtp_parse.parse_paramters_for_multiple_files(
83+
secrets = odtp_parse.parse_parameters_for_multiple_files(
6684
parameter_files=secrets_files, step_count=step_count)
6785
flowManager = WorkflowManager(execution, project_path, secrets)
6886
flowManager.run_workflow()

odtp/cli/new.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import odtp.helpers.parse as odtp_parse
99
import odtp.mongodb.utils as db_utils
1010
import odtp.helpers.utils as odtp_utils
11+
import odtp.helpers.git as odtp_git
1112

1213

1314
## Adding listing so we can have multiple flags
@@ -36,31 +37,23 @@ def odtp_component_entry(
3637
help="Specify the repository"
3738
)],
3839
component_version: Annotated[str, typer.Option(
39-
help="Specify the component version"
40-
)],
41-
odtp_version: Annotated[str, typer.Option(
42-
help="Specify the version of odtp"
43-
)] = None,
44-
commit: Annotated[str, typer.Option(
45-
help="""You may specify the commit of the repository. If not provided
46-
the latest commit will be fetched"""
47-
)] = None,
40+
help="Specify the tagged component version. It needs to be available on the github repo"
41+
)],
4842
type: Annotated[str, typer.Option(
4943
help="""You may specify the type of the component as either 'ephemeral or persistent'"""
5044
)] = db_utils.COMPONENT_TYPE_EPHERMAL,
5145
ports: Annotated[str, typer.Option(
5246
help="Specify ports seperated by a comma i.e. 8501,8201"
5347
)] = None,
54-
):
48+
):
5549
try:
5650
ports = odtp_parse.parse_component_ports(ports)
51+
repo_info = odtp_git.get_github_repo_info(repository)
5752
component_id, version_id = \
5853
db.add_component_version(
5954
component_name=name,
60-
repository=repository,
61-
odtp_version=odtp_version,
55+
repo_info=repo_info,
6256
component_version=component_version,
63-
commit_hash=commit,
6457
type=type,
6558
ports=ports,
6659
)
@@ -76,21 +69,32 @@ def odtp_component_entry(
7669

7770
@app.command()
7871
def digital_twin_entry(
79-
user_id: str = typer.Option(..., "--user-id", help="Specify the user ID"),
80-
name: str = typer.Option(..., "--name", help="Specify the name"),
72+
user_id: str = typer.Option(None, "--user-id", help="Specify the user ID"),
73+
user_email: str = typer.Option(None, "--user-email", help="Specify the email"),
74+
name: str = typer.Option(..., "--name", help="Specify the digital twin name"),
8175
):
76+
if user_id is None and user_email is None:
77+
raise typer.Exit("Please provide either --user-id or --user-email")
78+
79+
if user_email:
80+
user_id = db.get_document_id_by_field_value("user_email", user_email, "users")
81+
8282
dt_id = db.add_digital_twin(userRef=user_id, name=name)
8383
print(f"Digital Twin added with ID {dt_id}")
8484

8585

8686
@app.command()
8787
def execution_entry(
88+
execution_name: str = typer.Option(..., "--name", help="Specify the name of the execution"),
89+
dt_name: str = typer.Option(None, "--digital-twin-name", help="Specify the digital twin name"),
8890
dt_id: str = typer.Option(
89-
..., "--digital-twin-id", help="Specify the digital twin ID"
91+
None, "--digital-twin-id", help="Specify the digital twin ID"
92+
),
93+
component_tags: str = typer.Option(
94+
None, "--component-tags", help="Specify the components-tags (component-name:version) separated by commas"
9095
),
91-
execution_name: str = typer.Option(..., "--name", help="Specify the name of the execution"),
9296
component_versions: str = typer.Option(
93-
..., "--component-versions", help="Specify the version_ids separated by commas"
97+
None, "--component-versions", help="Specify the version_ids separated by commas"
9498
),
9599
parameter_files: Annotated[str, typer.Option(
96100
help="List the files containing the parameters by step separated by commas"
@@ -101,11 +105,23 @@ def execution_entry(
101105
)] = None,
102106
):
103107
try:
108+
if dt_name is None and dt_id is None:
109+
raise typer.Exit("Please provide either --digital-twin-name or --digital-twin-id")
110+
111+
if component_tags is None and component_versions is None:
112+
raise typer.Exit("Please provide either --component-tags or --component-versions")
113+
114+
if dt_name:
115+
dt_id = db.get_document_id_by_field_value("name", dt_name, "digitalTwins")
116+
117+
if component_tags:
118+
component_versions = ",".join(odtp_parse.parse_component_tags(component_tags))
119+
104120
versions = odtp_parse.parse_versions(component_versions)
105121
step_count = len(versions)
106122
ports = odtp_parse.parse_port_mappings_for_multiple_components(
107123
ports=ports, step_count=step_count)
108-
parameters = odtp_parse.parse_paramters_for_multiple_files(
124+
parameters = odtp_parse.parse_parameters_for_multiple_files(
109125
parameter_files=parameter_files, step_count=step_count)
110126
execution_id, step_ids = db.add_execution(
111127
dt_id=dt_id,

odtp/dashboard/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ def components():
5252
title="ODTP",
5353
storage_secret="private key to secure the browser session cookie",
5454
port=ODTP_DASHBOARD_PORT,
55-
reload=ODTP_DASHBOARD_RELOAD
55+
reload=ODTP_DASHBOARD_RELOAD,
5656
)

0 commit comments

Comments
 (0)