Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update_launchpad_data does not apply to tasks collection #451

Open
janosh opened this issue Aug 13, 2021 · 5 comments
Open

update_launchpad_data does not apply to tasks collection #451

janosh opened this issue Aug 13, 2021 · 5 comments

Comments

@janosh
Copy link
Member

janosh commented Aug 13, 2021

Currently update_launchpad_data applies only to ["launches", "fireworks", "workflows"] but omits the "tasks" collection. Is this a deliberate decision? Any reason "tasks" should not be changed?

def update_launchpad_data(lp, replacements, **kwargs):
"""
If you want to update a text string in your entire FireWorks database with a replacement, use this method.
For example, you might want to update a directory name preamble like "/scratch/user1" to "/project/user2".
The algorithm does a text replacement over the *entire* BSON document. The original collection is backed up within
the database with extension "_xiv_{Date}".
:param lp (LaunchPad): a FireWorks LaunchPad object
:param replacements (dict): e.g. {"old_path1": "new_path1", "scratch/":"project/"}
:param kwargs: Additional arguments accepted by the update_path_in_collection method
"""
for coll_name in ["launches", "fireworks", "workflows"]:
print("Updating data inside collection: {}".format(coll_name))
update_path_in_collection(lp.db, coll_name, replacements, **kwargs)
print("Update launchpad data complete.")

@mkhorton
Copy link
Member

The tasks collection is not created or managed by FireWorks since it's something created by atomate for the purpose of managing VASP calculations etc., FireWorks is agnostic about what other collections are present in the database since it's a general-purpose code.

The traditional way we've set up our databases when using FireWorks has been to have one database used exclusively by FireWorks, and another database for simulation artifacts like tasks, but more recently have been running them out of a single database for convenience.

@janosh
Copy link
Member Author

janosh commented Aug 13, 2021

I remembered after creating this issue that lpad itself doesn't write to the 'tasks' collection. So given the function name update_launchpad_data, it makes sense. But would you be open to adding a kwarg to handle additional collections? Also, I could add regex support while I'm at it.

@janosh
Copy link
Member Author

janosh commented Aug 20, 2021

@mkhorton I built and tested a version of update_launchpad_data that takes arbitrary collection names and also allows for regex replacements. Let me know if you'd like a PR for that. If not, this can be closed.

@mkhorton
Copy link
Member

Not my decision @janosh, @computron is the maintainer here :-)

@mkhorton
Copy link
Member

I think adding the kwarg sounds sensible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants