AspenPlus interface with Python #2
Replies: 4 comments 2 replies
-
Hey Vincent.
The only way I have found is using that node. This only deals with normal
simulation errors and not with program wide crashed.
Sometimes the whole Aspen just freezes. I used to detect this by taking
some stream, changing it's value, then reading the value you just changed.
If you get a value then the reading part works, if you get the value that
you wrote then you know that both reading and writing works.
Now if this takes more then X seconds I then know that neither of them are
working.
In this case I was unable to actually do anything. So I automatically
killed the Aspen program, os.kill (I think?) and restarted it from a safe
backup.
Op do 26 sep. 2024 14:02 schreef Vincent Bailey Ladd <
***@***.***>:
… @YouMayCallMeJesus <https://github.com/YouMayCallMeJesus> I was wondering
if your code had any nice ways to detect if Aspen throws up an error. So
far I have been using an error detection node from the aspen tree, but it
doesn't seem to work as intended. I would appreciate any help with figuring
out how to set up an effective error detection system for my project.
—
Reply to this email directly, view it on GitHub
<#2>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUUV43MF35ZDUSCH37LEAOTZYPZTRAVCNFSM6AAAAABO43IR4CVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGIZTSMJRGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately for my case I wouldn't be able to try and access a stream to detect an error. Typically my errors are infinite convergence errors. What made you choose to use os.kill() instead of aspen.Close() which uses the COM object? In my experience of closing aspen down using the task manager (which I think is similar to os.kill() ) the aspen file typically opens as a .bkp after instead of a .apw file as intended. |
Beta Was this translation helpful? Give feedback.
-
Hey Vincent,
To be honest I didn't try the Aspen.Close since I was unable to close the
application without using the task manager when using it manually.
But you are right it might work.
I found the same thing with the bkp file being the only thing available
(unless you regularly save it) but that was not a big deal in my
application.
I was just scrapping data to train some RL. If it crashed then I just
wanted it to detect it and then restart. If I lost a bit of progress that
didn't matter too much.
Hmm. Isn't there a convergence node? I am not sure but I though there was
something like that.
Good luck with your work
Richard
Op vr 27 sep. 2024 10:13 schreef
… Hi @YouMayCallMeJesus <https://github.com/YouMayCallMeJesus>
Unfortunately for my case I wouldn't be able to try and access a stream to
detect an error. Typically my errors are infinite convergence errors. What
made you choose to use os.kill() instead of aspen.Close() which uses the
COM object?
In my experience of closing aspen down using the task manager (which I
think is similar to os.kill() ) the aspen file typically opens as a .bkp
after instead of a .apw file as intended.
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUUV43IPPGLTFJEOA6WSNCLZYUHSDAVCNFSM6AAAAABO43IR4CVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZXGIZTSNY>
.
You are receiving this because you were mentioned.Message ID:
<YouMayCallMeJesus/AspenPlus-Python-Interface/repo-discussions/2/comments/10772397
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
Ahh ok. So you are using multiple aspen programs open at once or are you
using some kind of Aspen internal multiprocessing? I have only ever run
multiple aspen programs in parallel such that they had different names in
the task manager. Then when I detect a crash via the runtime limit I just
killed it and restarted it.
About the inputs being remembered when it crashes: in my testing the
crashes seem pretty random. Repeating a simulation that crashed for me did
not result in another crash.
I found that adding some delays like:
stream.temp=5
wait(1sec)
sim.run
Reduced the number of crashes... But it comes at a cost of making
everything slower. I decided to just not use it in the end.
Convergence node:
Sadly the Aspen team did not add everything to the tree that one would wish
for. I have first attempted to use the text files, to read them and then
extract data but it was too much of a pain and I gave up.
I just thought about a bit of a hacked way to detect the convergence. If
you find the convergence time distribution for your type of problem, you
could define a maximum amount of time you are willing to wait for a result.
Then you just use: self.AspenSimulation.Stop() to stop the simulation and
continue to the next one(and remembering which one took too long. This is
almost as if you had detected a convergence.
It might be that these difficult simulations are the most interesting but
that depends on your application.
Thanks a lot man!
If you get any nice results I would be happy to reference your GitHub to
show people some more advanced applications.
Cheers mate
Richard
Op za 28 sep. 2024 16:00 schreef Vincent Bailey Ladd <
***@***.***>:
… Hey Richard,
I have been using Aspen.Close(), but it doesn't seem to close down the
dispatched aspen in the task manager. I had some code that worked in
ensuring .bkp files were never opened, but it also opened an extra instance
of aspen every time (eating up my RAM).
I have been trying to develop some code that will detect a crash, and
store the simulation set up that caused the problem. The stored results are
then skipped (along with all the previous successful results), meaning that
even if it crashes, the code restarts that particular instance of aspen (as
I am multiprocessing across 16 simulations), and continues. But that is
still being developed.
I haven't found a convergence node, but I know that in the .his output
file after each simulation there is mention to if the simulation converged.
So it stands to reason that there is a convergence node that could be
accessed. Do you know where it is located on the tree?
Thank you for your help, you have some very comprehensive code for
accessing all of aspen plus in python!
Kind regards,
Vincent
—
Reply to this email directly, view it on GitHub
<#2 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUUV43PBNU6WYQRJYJ5RB6DZY2Y6VAVCNFSM6AAAAABO43IR4CVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZYGM4DSMI>
.
You are receiving this because you were mentioned.Message ID:
<YouMayCallMeJesus/AspenPlus-Python-Interface/repo-discussions/2/comments/10783891
@github.com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@YouMayCallMeJesus I was wondering if your code had any nice ways to detect if Aspen throws up an error. So far I have been using an error detection node from the aspen tree, but it doesn't seem to work as intended. I would appreciate any help with figuring out how to set up an effective error detection system for my project.
Beta Was this translation helpful? Give feedback.
All reactions