Hello,
I would like to querying fireworks just like in this page of doc : https://materialsproject.github.io/fireworks/query_tutorial.html, but from python.
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 …
def get_fws(discr, value):
if discr == "category":
cmd = "lpad get_fws -q '{\"spec._category\": \"%s\"}' -d ids" % value
elif discr == "state":
cmd = "lpad get_fws -s %s -d ids" % value
ids_json = subprocess.check_output(cmd, shell=True).decode('utf-8')
ids = json.loads(ids_json)
return ids
I haven’t find it in the doc. But I have found this on this list : launchpad.launches.find()
res = launchpad.launches.find({“spec._category”: “multiseq_long”}) -> may be ok: returns pymongo.cursor.Cursor
nb = launchpad.launches.count({“spec._category”: “multiseq_long”}) -> not OK : gives 0 (should be 26)
So it seems not to be the good way of doing it …
Could you provide us a way to do it ? in a first time, a count() will be sufficient, but an id list would be nice !
Best regards,
David