![]() |
I want OpenFOAM to email me when it's done, is this too much to ask?!?
Hi,
Is it possible to have the computer where your model is running send you an email (text message, or whatever) when either the model finished running, or when it breaks due to an error? I have a desktop computer running my OpenFoam models, and it sometimes takes minutes (when the model breaks) or hours (when the model successfully runs). Thanks P.D. I realize this might be more of a Linux than an OpenFoam question, but I bet it is very relevant to modeling. |
Hi Jose,
Well, it all depends on how you ran the case in the first place... if you used an Allrun script, identical to OpenFOAM's tutorials, then you can try adding this to the end of the script: Code:
echo "Sending separate email with the simulation status..." The "$application" variable is sometimes defined in Allrun scripts... for example in "tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun": https://github.com/OpenFOAM/OpenFOAM...tionFan/Allrun Best regards, Bruno |
Just as an addition.
If the system you run the jobs on is working with a resource management system like PBS/Torque, you can add something like Code:
#PBS -m ae -M albert.einstein@princeton.edu Cheers, L |
hello,
You may also take a look at the function Object "systemCall", which should also work. regards, olivier |
Greetings to all!
@Olivier: Nice one! But the downside of the "systemCall" is that it will only work if all goes well... By the way, for anyone who is intrigued by the "systemCall" function object: http://openfoamwiki.net/index.php/Ti...ect_systemCall Best regards, Bruno |
Quote:
That was the objective part. Here comes the advertisement: I implemented a general framework for that in pyFoam (in the runner-utilities to be concrete). If a solver started with one of these utilities stops a number of postRunHooks (which are configured by the user in sections that start with the name postRunHook) are run. Currently the concrete hooks that are implemented are - recording the run in a SQLite database - contacting a webservice at a specific URL and send some information The second one I use regularly. It contacts https://pushover.net and that service sends a message to my phone (which case, whether it ended OK etc). The configuration for that (minus my username and the API-key ;) ) is part of the distribution of pyFoam (you'd just have to insert your username/key and set it to enabled) as an example: it is templatable so any similar webservice could be used. Ah. And BTW: this only sends messages if the run took longer than X seconds. That way my phone doesn't get spammed with runs that don't get past the first timestep Mails could work with these Hooks too, but I haven't had the need for that yet so that is not yet implemented PS: to use pushover you don't have to use pyFoam. That can be easily accessed from shell-scripts too |
1 Attachment(s)
Quote:
I use a script that have set its address in bashrc,how to add this code to that script? and how to use bsd-mailx? |
Hi Ehsan,
Quote:
Code:
yourname@email.address Code:
$MY_EMAIL_ADDRESS Code:
export MY_EMAIL_ADDRESS=yourname@email.address Quote:
Code:
sudo apt-get install bsd-mailx Bruno |
Hi Bruno
I use this script as you mentioned: Code:
#!/bin/bash Code:
/home/ehsan/Desktop/codes/runPlot: line 4: getApplication: command not found I found this file containing a log of solution:PyFoamRunner.rhoCentralFoamGasCont.logfil e how can I put it in the code such that the solver read from controlDict instead of explicitly assigned?and why get Application didn't work? |
I have my cases set up to run a Python script that emails me when a simulation finishes. See http://petebachant.me/automatic-email-openfoam/ for the code I used. I also put lines in the Allrun.pre and Allrun scripts to send desktop notifications when meshing or simulations finish. Example:
Code:
notify-send "OpenFOAM" "Meshing finished." |
Thanks a lot,how can make it send SMS?
this link is unfortunately banned here,could you please send me the required texts? http://alextrle.blogspot.com/2011/05...th-python.html |
Quote:
http://en.wikipedia.org/wiki/List_of_SMS_gateways |
Greetings to all!
@Ehsan: That's what happens when you don't use the convention used in OpenFOAM's tutorials. An example that can be used in the tutorials is this: Code:
#!/bin/sh The "runApplication" function will run the application indicated by "getApplication" and will automatically log the output inside the file "log.$application". Best regards, Bruno |
Hi Bruno
but I was using pyFoam for run,which form is suitable for my case? although fortunately the runs are ended successfully. |
But... it's so simple to look at the code, compare with what I wrote, and fix it yourself!!
Instead of this: Quote:
Code:
#!/bin/bash |
dear Bruno
you know I wanted a more general form,but never mind,I'm engaging with making a lot of graphs now! |
Dear Bruno I performed a quick run while I've added this to .bashrc:
Code:
export MY_EMAIL_ADDRESS=force.of.love@gmail.com Code:
End it has forgotten me after one year being friend with me:( it doesn't send me even an email now!:D;) how long it takes to send it?it should be interesting.:cool: --------- it seems it hasn't read the file at all because the messages in block aren't shown,right Bruno? |
Hi Ehsan,
When dealing with programming, you should always test the code before using it in critical deployments. Therefore, try running this from the command line: Code:
echo "Testing emailing functionality" | mail -s "Summary Report from the case $PWD" $MY_EMAIL_ADDRESS Best regards, Bruno |
it doesn't complain about something but doesn't send an email.
Code:
ehsan@Ehsan-com:~$ echo "Testing emailing functionality" | mail -s "Summary Report from the case $PWD" $MY_EMAIL_ADDRESS |
Well, the only way I could get it to send emails was to send them to the machine I'm working one, like this:
Code:
echo "Testing emailing functionality" | mail -s "Summary Report from the case $PWD" $USER@localhost Code:
mail |
All times are GMT -4. The time now is 16:13. |