Opened 2 months ago

Closed 8 weeks ago

#1173 closed defect (fixed)

more problems with math in plugins

Reported by: butler Owned by: pkienzle
Priority: critical Milestone: SasView 4.2.0
Component: SasView Keywords:
Cc: Work Package: McSAS Integration Project

Description

while testing a pull request downloaded from the jenkins build thereof, the old

unsupported operand type(s) for *:'NoneType' and 'float'

reared its head again. Other plugins had no problems. Further investigation shows that the exact same function generated from a 4.2 "create model" works while the failing function was created in 4.1.2? However, after editing so that code wise they look identical to me the "older" version continues to fail on the math while the new one does not. I attach the two files.

Is this due to sasmodels infrastructure running these two identical codes differently with one path being wrong? i.e. having a bug not present in the way the files identified as new don't?

Our release notes say we support old style models am listing this as critical to 4.2 release. At the very least we need to correct the release notes if we cannot resolve this issue.

Attachments (3)

L3_Porcar_et_al.py (1.0 KB) - added by butler 2 months ago.
failing older version edited to be "identical" to new version
L3_Porcar_et_alNEW.py (1.5 KB) - added by butler 2 months ago.
New version which runs without problem
Porcar_Pq_Sq.py (237 bytes) - added by butler 2 months ago.
offending multiply model

Download all attachments as: .zip

Change History (11)

Changed 2 months ago by butler

failing older version edited to be "identical" to new version

Changed 2 months ago by butler

New version which runs without problem

comment:1 Changed 2 months ago by butler

  • Owner set to pkienzle
  • Status changed from new to assigned

comment:2 Changed 2 months ago by pkienzle

See #1142.

comment:3 Changed 2 months ago by pkienzle

It seems to work with master for sasview and sasmodels (2016-09-11) on mac started with run.py.

Please give the steps required to reproduce.

comment:4 Changed 2 months ago by butler

Interesting …. by "works with master" I assume you mean on your local development environment? If so this may indicate the problem is with the build machine. I should test with the latest development build (rather than the PR build).

Changed 2 months ago by butler

offending multiply model

comment:5 Changed 2 months ago by butler

Hummm…. so it seems the problem was more subtle and involves the presence of a multiply model multiplying the "offending" model by a plugin SQ. Removing the pyc for that multiply model does not help. So why does the mere existence of another plugin affect in any way whether the first plugin can pull in the math? I attach the multiply model.

comment:6 Changed 2 months ago by pkienzle

Because the model is written with load_model_info(), this does a reload on the parts, L3_Porcar_et_al and L3_Sq, and it is the reload which is causing problems with the namespace for the module.

This could be resolved by throwing a cache in sasmodels.custom which checks the timestamp on the file before reloading the module. This should be a relatively small fix suitable for 4.2, and at least allow L3_Porcar_Sq_Pq to load.

There will still be problems: if Pq or Sq are edited and reloaded, then Porcar_Pq_Sq will be break. This one is harder to resolve since the timestamp on Porcar_Pq_Sq will not have changed, and so Sasview will not know that it needs to be reloaded. I'm guessing for a proper fix for this we will have to maintain a tree of dependencies, and force a reload of all those that are affected by the change of a timestamp. This is a 4.3 fix.

comment:7 Changed 2 months ago by butler

So if I understand what is happening now, there is the same reload problem causing math to be cleared out as before but in a more subtle way? If true that would mean that:

I create plugin model A and it works
I create plugin model B and it works
etc
and all is happy

NOW if I do a sum/multiply model that uses A, for example
NewModel1 = A * hard_sphere or even
NewModel2 = A + B

all of a sudden Models A and B no longer work?!

I will try to test this. If true it needs fixing in 4.2 if at all possible. Maybe the "relatively small fix suitable for 4.2" would do the trick?

comment:8 Changed 8 weeks ago by GitHub <noreply@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In dd16e070c2ce8fc5bba6a4c0ff93205310f52888/sasmodels:

Merge pull request #80 from SasView?/ticket-1173-cache-loadinfo

Ticket 1173: cache load info

Closes #1173

Note: See TracTickets for help on using tickets.