Skip to content

Instantly share code, notes, and snippets.

@jmmshn
Created May 5, 2023 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmmshn/2d69dae866cad191597d6014c4a71e08 to your computer and use it in GitHub Desktop.
Save jmmshn/2d69dae866cad191597d6014c4a71e08 to your computer and use it in GitHub Desktop.
[update fireworks database] check the structure charge and update the charge #fireworks
for doc in FW_STORE.query({
"spec._tasks.0.job.function_args.0.charge": {"$exists": 1},
"spec._tasks.0.job.function.@bound.write_additional_data.info:json": {"$exists": 1},
# "fw_id" : {"$gt" : 1000}
}
):
chg_structure = doc["spec"]["_tasks"][0]["job"]["function_args"][0]["charge"]
chg_defect = doc["spec"]["_tasks"][0]["job"]["function"]["@bound"]["write_additional_data"]["info:json"]["charge_state"]
if chg_structure != chg_defect:
print('messed', doc["fw_id"])
FW_STORE._collection.update_one(
{"_id": doc["_id"]},
{"$set": {"spec._tasks.0.job.function_args.0.charge": int(chg_defect)}},
)
LPAD.rerun_fw(doc["fw_id"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment