dlubal-software / RSTAB_Python_Client

Python client (or high-level functions) for RSTAB 9 using Web Services, SOAP, and WSDL
MIT License
9 stars 4 forks source link

BUG: Creating new model creates new suds client (each time) #12

Closed and-ratajski closed 1 year ago

and-ratajski commented 1 year ago

Describe the bug Whenever one tries to create a new model after closing a new one (model = Model(True, "model_name")), following Exception gets thrown:

    model = Model(True, MODEL_NAME)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\RSTAB\initModel.py", line 126, in __init__
    cModel = Client(modelCompletePath, transport=trans, location = modelUrlPort)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\client.py", line 109, in __init__
    self.set_options(**kwargs)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\client.py", line 129, in set_options
    p.update(kwargs)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 258, in update
    self.set(n, v)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 283, in set
    self.provider(name).__set(name, value)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 428, in __set
    d.linker.updated(self, prev, value)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\options.py", line 40, in updated
    properties.link(tp)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 319, in link
    Link(self, other)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 59, in __init__
    self.validate(a, b)
  File "C:\Users\Administrator\Desktop\RSTAB_Creoox_Test\venv\lib\site-packages\suds\properties.py", line 80, in validate
    raise Exception('Duplicate domain "%s" found' % d)
Exception: Duplicate domain "suds.options" found

It is because whenever a new Model instance is requested, it also creates a new suds Client for the same name and url, here:

https://github.com/Dlubal-Software/RSTAB_Python_Client/blob/14b06d28bc77731d72fe84cdaf6e71cad82161cc/RSTAB/initModel.py#L123-L127

And if there is no other workaround but to entirely close (clean) python runtime and start from the begging...

To Reproduce Steps to reproduce the behavior:

  1. Create Model instance (model = Model(True, "model_name")).
  2. Add some materials, sections, nodes, loads, etc...
  3. Run calculations
  4. Close model
  5. Create new Model instance (model = Model(True, "new_model_name")) in the same python runtime

At this point you should see the exact same error.

Expected behavior Creating a new model while maintaining connection to RSTAB/RFEM server.

Desktop (please complete the following information):

Additional context Trying to compare calculations using the same model vs. creating a new model each time. If there is such a need I can provide my testing script.

dogukankaratas commented 1 year ago

Hi, Fixed in the main branch.

and-ratajski commented 1 year ago

Hi @dogukankaratas , So does it mean that this issue is resolved (fixed, tested, deployed) and soft pushed to pip repository?

By the way - what is the release strategy? Each fix would be available as new release or do you plan to group them and release together (milestones)?

OndraMichal commented 1 year ago

Hi @and-ratajski, every update is available in main branch immediately after code review. We don't publish every change on pypi.org page. We release the client when there is substantial work done. No milestones are set. This is same for both RFEM and RSTAB. But all development is done in RFEM. Then after there is considerable work done, relevant changes are copied, since RSTAB functions are subset of RFEM's.