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

Custom artifact import #287

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Custom artifact import #287

merged 3 commits into from
Jun 12, 2024

Conversation

abhilash-kumar-nair
Copy link
Contributor

@abhilash-kumar-nair abhilash-kumar-nair commented Jun 7, 2024

Code to test
Jira - https://modelonproducts.atlassian.net/browse/FLOW-527

from modelon.impact.client import Client

client = Client(url="http://localhost:8888/impact", interactive=True)
workspace = client.get_workspace("test")

# Choose analysis type
dynamic = workspace.get_custom_function('dynamic')

# Get model class
model = workspace.get_model("Modelica.Blocks.Examples.PID_Controller")

# Execute experiment
experiment_definition = model.new_experiment_definition(dynamic)
exp = workspace.create_experiment(experiment_definition)
exp = exp.execute().wait()
case = exp.get_case('case_1')
path= "/home/akn/Downloads/Result 2.csv"
ca_import = case.import_custom_artifact(path, "test")
print(ca_import.status)
ca=ca_import.wait()
print(ca.id)

@iakovn
Copy link
Member

iakovn commented Jun 10, 2024

@psundstrom @maraberg are you OK with the example flow above?

@abhilash-kumar-nair I suggest we mark the method experimental as we probably need do bump required open api version to enable this feature.

@maraberg
Copy link

It looks good to me, follow the "execute" pattern with wait() operation which I like.

@abhilash-kumar-nair
Copy link
Contributor Author

@psundstrom @maraberg are you OK with the example flow above?

@abhilash-kumar-nair I suggest we mark the method experimental as we probably need do bump required open api version to enable this feature.

@iakovn Sure! Done!

@psundstrom
Copy link

Looks good to me to. Will there be a corresponding .get workflow to find out what custom artifacts there are for a case?

Also I see a risk that you might upload artifacts to old results that you didn't intend to. This is solved if you can mark a case/experiment as finalized and then you can't change it.

@abhilash-kumar-nair
Copy link
Contributor Author

Looks good to me to. Will there be a corresponding .get workflow to find out what custom artifacts there are for a case?

Also I see a risk that you might upload artifacts to old results that you didn't intend to. This is solved if you can mark a case/experiment as finalized and then you can't change it.

We already have an api for fetching artifacts for a case?
custom_artifacts = case.get_artifacts()

Hmm what do you mean by Old results? A user will get an error if they try to upload a artifact with ID same as an existing ID unless they specify overwrite.(See the latest commit)

@psundstrom
Copy link

Looks good to me to. Will there be a corresponding .get workflow to find out what custom artifacts there are for a case?
Also I see a risk that you might upload artifacts to old results that you didn't intend to. This is solved if you can mark a case/experiment as finalized and then you can't change it.

We already have an api for fetching artifacts for a case? custom_artifacts = case.get_artifacts()
Lovely!

Hmm what do you mean by Old results? A user will get an error if they try to upload a artifact with ID same as an existing ID unless they specify overwrite.(See the latest commit)
I meant there's nothing preventing me from adding artifacts to a 2 month old result. But this is a separate topic I think.

Copy link
Member

@iakovn iakovn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get it in! ✈️

@abhilash-kumar-nair abhilash-kumar-nair merged commit fd2dbbc into master Jun 12, 2024
1 check passed
@abhilash-kumar-nair abhilash-kumar-nair deleted the custom-artifact-import branch June 12, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants