nens / threedi-api-qgis-client

3Di Models & Simulations plugin
https://plugins.lizard.net/
Other
2 stars 0 forks source link

Simulation wizard: Add option to enter Project name #517

Closed leendertvanwolfswinkel closed 4 months ago

leendertvanwolfswinkel commented 9 months ago

UI implementation: On the "name" page, add a text widget "Project". It is optional, can be left empty.

Technical implementation: add the value that that the user filled in (if not None or "") as tag with the following format: f"project: {user_input}"

leendertvanwolfswinkel commented 8 months ago

@ldebek I get

An error has occurred while executing Python code: 

AttributeError: 'NameWidget' object has no attribute 'le_project_name' 
Traceback (most recent call last):
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\3Di Staging/python/plugins\threedi_models_and_simulations\widgets\simulation_wizard.py", line 2711, in run_new_simulation
    project_name = self.name_page.main_widget.le_project_name.text()
AttributeError: 'NameWidget' object has no attribute 'le_project_name'
ldebek commented 8 months ago

@leendertvanwolfswinkel Typo fixed.

leendertvanwolfswinkel commented 8 months ago

@ldebek something odd is going on. the actual simulation that is run, does not have the "project:{something}" tag. But the simulation that the simulation template refers to does have this tag. Perhaps a backend issue?

To verify this, I created a simulation on production with the production version of 3Di Models & Simulations, and this also does not create a tag on the simulation that is actually run.

What do you think the issue is that I can pass to our backend team?

ldebek commented 8 months ago

@leendertvanwolfswinkel Looks like a backend issue. Especialy that simulation template is created out of the spawned simulation, and as you mentioned - tags are present there.

leendertvanwolfswinkel commented 7 months ago

@ldebek Jelle tells me that this behaviour is by design. You are supposed to give the tags as arguments when calling the /v3/simulations/from-template/ endpoint

ldebek commented 7 months ago

@leendertvanwolfswinkel /v3/simulations/from-template/ endpoint is not used during running simulations at all, so I don't think that's the case. Creating new simulation is done via /v3/simulations POST endpoint, where the tags are passed. And simulation template created from the simulation created in such way inherits correct tags. Issue is that the Simulation instance seems to drop tags at some point.

leendertvanwolfswinkel commented 5 months ago

@ldebek our backend team went into this a bit; apparently there was some sort of bug with creating tags, but this has been resolved (on staging). I have successfully started a simulation with tags using the /v3/simulations POST endpoint, with tags that are correctly processed. See the script in this zip reproduce_tags_issue.zip

However, it still does not work for me when I use the simulation wizard on the branch for this issue.

Perhaps upgrading threedi-api-client to 4.1.5 would help?

leendertvanwolfswinkel commented 5 months ago

@ldebek ok I did some more testing and the threedi-api-client version does not seem to make any difference