I can do it from the shell just as indicated in this page, but I need to get these information periodically in a python program
For the moment I use a subprocess to retrieve this information from the CLI (see below), but It would be much faster to do it from a Launchpad object in python …
The “lpad get_fws” command uses a two step process:
i) Launchpad.get_fw_ids() to get the list of matching FW ids
ii) Launchpad.get_fw_by_id() to get the details of a Firework once you know the ids
Part (ii) is straightforward. For (i) you will just need to pass in your Mongo query dict, e.g. something like {“spec._category”: “category1”}. Note that (i) only takes in a Mongo query dict and doesn’t take any other type of query (e.g., no direct query on state). To see how the other options like “get_fws -s FIZZLED” are translated into a Mongo query dict, look at fireworks.scripts.lpad_run.get_fws(). In fact, the entire source code for how to turn the command line options into Python is in that function.
I can do it from the shell just as indicated in this page, but I need to get these information periodically in a python program
For the moment I use a subprocess to retrieve this information from the CLI (see below), but It would be much faster to do it from a Launchpad object in python …
Thank you for the quick response. I managed to use the python interface. It works very fine now.
Thanks a lot !
Best regards,
David
···
Le vendredi 8 septembre 2017 18:03:44 UTC+2, ajain a écrit :
Hi David
The “lpad get_fws” command uses a two step process:
i) Launchpad.get_fw_ids() to get the list of matching FW ids
ii) Launchpad.get_fw_by_id() to get the details of a Firework once you know the ids
Part (ii) is straightforward. For (i) you will just need to pass in your Mongo query dict, e.g. something like {“spec._category”: “category1”}. Note that (i) only takes in a Mongo query dict and doesn’t take any other type of query (e.g., no direct query on state). To see how the other options like “get_fws -s FIZZLED” are translated into a Mongo query dict, look at fireworks.scripts.lpad_run.get_fws(). In fact, the entire source code for how to turn the command line options into Python is in that function.
I can do it from the shell just as indicated in this page, but I need to get these information periodically in a python program
For the moment I use a subprocess to retrieve this information from the CLI (see below), but It would be much faster to do it from a Launchpad object in python …
No, you can only cancel (“defuse”) jobs via manual command. The fizzled (failed) tag is only set by FireWorks, or you would need to go in and manually hack the database (which is tricky since the Launch state should match the Firework state, and the fw_states key of the Workflow needs to be updated for example).
Firework states : Waiting, Completed, Reserved, Ready. I am able to get these states for my firework jobs and I am able to query thes states using launchpad.get_fw_by_id(fw_id).state
But I am not able to get RUNNING state as output for any firework jobs. Is RUNNING state will be visible for firework jobs