asynchronous running of Chimera extensions

Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way. Is it possible? Please do not hesitate to contact us if you require further information about our project. Best regards, Marcin Pawlowski

Hi Marcin, Correct me if I'm wrong developers, but I believe you should be able to run your extension as a "background process". In linux it involve calling your script with a "&" simple at the end of the command from terminal, i.e. python test.py& This would allow the process to execute in the background. Hope that helps, Chris On Thu, Aug 12, 2010 at 5:57 AM, Marcin Pawlowski <marcinp@genesilico.pl>wrote:
Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further information about our project.
Best regards, Marcin Pawlowski
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Thank for your mail. That was the first think I thought :-) Unfortunately, calling my script with a & causes that I lack all communication with my script (the plugin). We need something like AJAX. Quoting christopher lau <chris.d.lau@gmail.com>:
Hi Marcin,
Correct me if I'm wrong developers, but I believe you should be able to run your extension as a "background process". In linux it involve calling your script with a "&" simple at the end of the command from terminal, i.e.
python test.py&
This would allow the process to execute in the background.
Hope that helps,
Chris
On Thu, Aug 12, 2010 at 5:57 AM, Marcin Pawlowski <marcinp@genesilico.pl[1]> wrote:
Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further information about our project.
Best regards, Marcin Pawlowski
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu[2] http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
------------------------- Scanned for malicious content. See headers for details. Links: ------ [1] mailto:marcinp@genesilico.pl [2] mailto:Chimera-dev@cgl.ucsf.edu

Chimera has code for running jobs in the background while keeping the GUI active. Some of this code is still under development and I would suggest using the daily build rather than 1.4.1. Here are the relevant modules and an example: chimera.SubprocessMonitor Module for running and monitoring background process chimera.tasks Module for display background tasks in the task manager interface chimera.printer SubprocessMonitor is used in saveImage() to launch background POV-Ray If you are using a web service rather than running the program on the local machine, there are other modules that may be of interest. Conrad On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further information about our project.
Best regards, Marcin Pawlowski
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Great. Thanks a lot. We using both of them 1) using a web service and 2) running the program on the local machine. Quoting Conrad Huang <conrad@cgl.ucsf.edu>:
Chimera has code for running jobs in the background while keeping the GUI active. Some of this code is still under development and I would suggest using the daily build rather than 1.4.1. Here are the relevant modules and an example:
chimera.SubprocessMonitor Module for running and monitoring background process chimera.tasks Module for display background tasks in the task manager interface chimera.printer SubprocessMonitor is used in saveImage() to launch background POV-Ray
If you are using a web service rather than running the program on the local machine, there are other modules that may be of interest.
Conrad
On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further information about our project.
Best regards, Marcin Pawlowski
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

On Aug 16, 2010, at 3:54 PM, Marcin Pawlowski wrote:
Great. Thanks a lot.
We using both of them 1) using a web service and 2) running the program on the local machine.
Hi Marcin, Unfortunately Conrad is sick today, so I'll try to answer the web service question without causing too much damage. :-) So the answer depends a bit on how the back-end web service is implemented. If it's implemented as an Opal service, you should look at the StructureDiagram.ws module, in particular the CDKDepictionService._runAsTask method. It's probably more efficient for you to ask questions about the code than to have me explain it line by line. Besides, I think it's actually pretty straightforward in this case. If the web service is implemented by REST, try looking at the ModBase.gui module, particularly the FetchScore._submitJob method. That method posts a multipart form to a REST service and reads back the result. You could adapt that code and use the same task "wrapper" that the Opal code uses. That code doesn't directly use a task wrapper because it is one of many requests that Chimera will be making to that web service (usually 10-20 at once), so it uses a queue to prevent overwhelming the remote server with requests. If your service will be making multiple requests at once then maybe you would want to do the same thing. If so, then look FetchScore.__init__ to see how the queue is set up (the httpq.get(), hq.newSlot(), and slot.request() calls) and then the end of the FetchScore._submitJob method to see how secondary requests to the server (if any) can be added to the queue with q.put(). Please feel free to ask more questions! --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
Quoting Conrad Huang <conrad@cgl.ucsf.edu>:
Chimera has code for running jobs in the background while keeping the GUI active. Some of this code is still under development and I would suggest using the daily build rather than 1.4.1. Here are the relevant modules and an example:
chimera.SubprocessMonitor Module for running and monitoring background process chimera.tasks Module for display background tasks in the task manager interface chimera.printer SubprocessMonitor is used in saveImage() to launch background POV- Ray
If you are using a web service rather than running the program on the local machine, there are other modules that may be of interest.
Conrad
On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers. Me and of my students are developing a chimera extension to deal with protein structures. Unfortunately, the execution of our plunging last at least 5 minutes, so during this time the chimera program is hinged. We would like to execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further information about our project.
Best regards, Marcin Pawlowski
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Thanks a lot for the email you sent me. Now I need to talk to one of my coworkers- Sebastian Opalczynski, who will be at work next week. We will touch you soon. Cheers Marcin Quoting Eric Pettersen <pett@cgl.ucsf.edu>:
On Aug 16, 2010, at 3:54 PM, Marcin Pawlowski wrote: Great. Thanks a lot.
We using both of them 1) using a web service and 2) running the program on the local machine.
Hi Marcin, Unfortunately Conrad is sick today, so I'll try to answer the web service question without causing too much damage. :-) So the answer depends a bit on how the back-end web service is implemented. If it's implemented as an Opal service, you should look at the StructureDiagram.ws module, in particular the CDKDepictionService._runAsTask method. It's probably more efficient for you to ask questions about the code than to have me explain it line by line. Besides, I think it's actually pretty straightforward in this case. If the web service is implemented by REST, try looking at the ModBase.gui module, particularly the FetchScore._submitJob method. That method posts a multipart form to a REST service and reads back the result. You could adapt that code and use the same task "wrapper" that the Opal code uses. That code doesn't directly use a task wrapper because it is one of /many/ requests that Chimera will be making to that web service (usually 10-20 at once), so it uses a queue to prevent overwhelming the remote server with requests. If your service will be making multiple requests at once then maybe you would want to do the same thing. If so, then look FetchScore.__init__ to see how the queue is set up (the httpq.get(), hq.newSlot(), and slot.request() calls) and then the end of the FetchScore._submitJob method to see how secondary requests to the server (if any) can be added to the queue with q.put(). Please feel free to ask more questions! --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu[1]
Quoting Conrad Huang <conrad@cgl.ucsf.edu[2]>:
Chimera has code for running jobs in the background while keeping
the GUI active. Some of this code is still under development and I
would suggest using the daily build rather than 1.4.1. Here are the
relevant modules and an example:
chimera.SubprocessMonitor
Module for running and monitoring background process
chimera.tasks
Module for display background tasks in the task manager interface
chimera.printer
SubprocessMonitor is used in saveImage() to launch background POV-Ray
If you are using a web service rather than running the program on
the local machine, there are other modules that may be of interest.
Conrad
On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers.
Me and of my students are developing a chimera extension to deal with
protein structures.
Unfortunately, the execution of our plunging last at least 5 minutes,
so during this time the chimera program is hinged. We would like to
execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further
information about our project.
Best regards,
Marcin Pawlowski
_______________________________________________
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.edu[3]
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu[5] http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev ------------------------- Scanned for malicious content. See headers for details. Links: ------ [1] http://www.cgl.ucsf.edu [2] mailto:conrad@cgl.ucsf.edu [3] mailto:Chimera-dev@cgl.ucsf.edu [4] http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev [5] mailto:Chimera-dev@cgl.ucsf.edu

Eric gave a better answer than I could for web services. For running local jobs, there is a new example in the programmer's guide (see http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples) under "Running a Background Process". Conrad On 8/17/2010 12:22 PM, Marcin Pawlowski wrote:
Thanks a lot for the email you sent me.
Now I need to talk to one of my coworkers- Sebastian Opalczynski, who will be at work next week. We will touch you soon.
Cheers
Marcin
Quoting Eric Pettersen <pett@cgl.ucsf.edu>:
On Aug 16, 2010, at 3:54 PM, Marcin Pawlowski wrote:
Great. Thanks a lot.
We using both of them 1) using a web service and 2) running the program on the local machine.
Hi Marcin, Unfortunately Conrad is sick today, so I'll try to answer the web service question without causing too much damage. :-) So the answer depends a bit on how the back-end web service is implemented. If it's implemented as an Opal service, you should look at the StructureDiagram.ws module, in particular the CDKDepictionService._runAsTask method. It's probably more efficient for you to ask questions about the code than to have me explain it line by line. Besides, I think it's actually pretty straightforward in this case. If the web service is implemented by REST, try looking at the ModBase.gui module, particularly the FetchScore._submitJob method. That method posts a multipart form to a REST service and reads back the result. You could adapt that code and use the same task "wrapper" that the Opal code uses. That code doesn't directly use a task wrapper because it is one of /many/ requests that Chimera will be making to that web service (usually 10-20 at once), so it uses a queue to prevent overwhelming the remote server with requests. If your service will be making multiple requests at once then maybe you would want to do the same thing. If so, then look FetchScore.__init__ to see how the queue is set up (the httpq.get(), hq.newSlot(), and slot.request() calls) and then the end of the FetchScore._submitJob method to see how secondary requests to the server (if any) can be added to the queue with q.put(). Please feel free to ask more questions!
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
Quoting Conrad Huang <conrad@cgl.ucsf.edu <mailto:conrad@cgl.ucsf.edu>>:
Chimera has code for running jobs in the background while keeping
the GUI active. Some of this code is still under development and I
would suggest using the daily build rather than 1.4.1. Here are the
relevant modules and an example:
chimera.SubprocessMonitor
Module for running and monitoring background process
chimera.tasks
Module for display background tasks in the task manager interface
chimera.printer
SubprocessMonitor is used in saveImage() to launch background POV-Ray
If you are using a web service rather than running the program on
the local machine, there are other modules that may be of interest.
Conrad
On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers.
Me and of my students are developing a chimera extension to deal with
protein structures.
Unfortunately, the execution of our plunging last at least 5 minutes,
so during this time the chimera program is hinged. We would like to
execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further
information about our project.
Best regards,
Marcin Pawlowski
_______________________________________________
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.edu <mailto:Chimera-dev@cgl.ucsf.edu>
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu <mailto:Chimera-dev@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
------------------------------------------------------------------------
Scanned for malicious content. See headers for details.

Thanks a lot!. It seems to perfectly answer our question. Cheers Marcin Quoting Conrad Huang <conrad@cgl.ucsf.edu>:
Eric gave a better answer than I could for web services. For running local jobs, there is a new example in the programmer's guide (see http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples) under "Running a Background Process".
Conrad
On 8/17/2010 12:22 PM, Marcin Pawlowski wrote:
Thanks a lot for the email you sent me.
Now I need to talk to one of my coworkers- Sebastian Opalczynski, who will be at work next week. We will touch you soon.
Cheers
Marcin
Quoting Eric Pettersen <pett@cgl.ucsf.edu>:
On Aug 16, 2010, at 3:54 PM, Marcin Pawlowski wrote:
Great. Thanks a lot.
We using both of them 1) using a web service and 2) running the program on the local machine.
Hi Marcin, Unfortunately Conrad is sick today, so I'll try to answer the web service question without causing too much damage. :-) So the answer depends a bit on how the back-end web service is implemented. If it's implemented as an Opal service, you should look at the StructureDiagram.ws module, in particular the CDKDepictionService._runAsTask method. It's probably more efficient for you to ask questions about the code than to have me explain it line by line. Besides, I think it's actually pretty straightforward in this case. If the web service is implemented by REST, try looking at the ModBase.gui module, particularly the FetchScore._submitJob method. That method posts a multipart form to a REST service and reads back the result. You could adapt that code and use the same task "wrapper" that the Opal code uses. That code doesn't directly use a task wrapper because it is one of /many/ requests that Chimera will be making to that web service (usually 10-20 at once), so it uses a queue to prevent overwhelming the remote server with requests. If your service will be making multiple requests at once then maybe you would want to do the same thing. If so, then look FetchScore.__init__ to see how the queue is set up (the httpq.get(), hq.newSlot(), and slot.request() calls) and then the end of the FetchScore._submitJob method to see how secondary requests to the server (if any) can be added to the queue with q.put(). Please feel free to ask more questions!
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
Quoting Conrad Huang <conrad@cgl.ucsf.edu <mailto:conrad@cgl.ucsf.edu>>:
Chimera has code for running jobs in the background while keeping
the GUI active. Some of this code is still under development and I
would suggest using the daily build rather than 1.4.1. Here are the
relevant modules and an example:
chimera.SubprocessMonitor
Module for running and monitoring background process
chimera.tasks
Module for display background tasks in the task manager interface
chimera.printer
SubprocessMonitor is used in saveImage() to launch background POV-Ray
If you are using a web service rather than running the program on
the local machine, there are other modules that may be of interest.
Conrad
On 8/12/10 5:57 AM, Marcin Pawlowski wrote:
Dear Chimera developers.
Me and of my students are developing a chimera extension to deal with
protein structures.
Unfortunately, the execution of our plunging last at least 5 minutes,
so during this time the chimera program is hinged. We would like to
execute the program in an asynchronous way.
Is it possible?
Please do not hesitate to contact us if you require further
information about our project.
Best regards,
Marcin Pawlowski
_______________________________________________
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.edu <mailto:Chimera-dev@cgl.ucsf.edu>
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu <mailto:Chimera-dev@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
------------------------------------------------------------------------
Scanned for malicious content. See headers for details.
participants (4)
-
christopher lau
-
Conrad Huang
-
Eric Pettersen
-
Marcin Pawlowski