Re: Thread terminating 10 seconds after entering __del__
Philip Aston <[email protected]>
| Newsgroups | gmane.comp.java.grinder.user |
|---|---|
| Message-ID | <[email protected]> |
Sorry, the 10 second grace period is not configurable. It applies to all "shutdown process", so it doesn't matter whether you use __del__, at_exit, or some other mechanism. You could fork another process to do the copying, but that is probably best done from Java and may require work to ensure the child doesn't exit with the parent. The simplest thing is probably to build a custom version of the grinder from source, and modify the timeout. (See GrinderProcess.java). - Phil On 19/03/14 15:10, Abdallah Khazaal wrote: > > Hi All, > > > > My script tries to execute “final code” in __del__ after all threads > complete their work in __call__ (i.e. after the /grinder.duration/ is > reached). > > > > def*__del__*(/self/): > > # Wait for all other threads to complete before executing further > > /self/.finalCompleteBarrier.await() > > ifgrinder.getThreadNumber() == 0: > > # If this is Thread 0, retrieve files from remote server > > /copyFiles()/ > > > > This is working as expected except that the process is terminated > before the /copyFiles()/ procedure is completed. > > > > My understanding is that the main thread doesn't terminate the worker > threads and exists the process until 10 seconds pass after the worker > threads signal that should exit. > > > > In most cases, this should be enough time to finish executing the code > in /__del__/ for each thread. However, in my case, if the > /copyFiles()/ procedure takes longer than 10 seconds (say because they > are copied form remote server or the files are too big), then the > process terminates before completing the job. > > > > Is there a way to increase the 10 seconds waiting time to allow for > more executing time in /__del__/? > > > > If not, are you aware of a better way/place to execute final code once? > > > > Thanks in advance for your help! > > > > > > Abdallah > > > > ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ grinder-use mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/grinder-use