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

Added scripts to run a backup between tiled servers running different versions #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmaruland
Copy link
Contributor

This PR adds script that allows running a backup from our instance of aimmdb in https://aimm.lbl.gov/api to https://tiled-demo.blueskyproject.io.
The first instance was running in a much older version of tiled and it was not compatible to try to connect to both instances using one environment with the same tiled client. the solution includes two steps: 1) downloading all the data to the local machine as json files and 2) reading the json files and uploading the data to the new site.

Copy link
Contributor

@danielballan danielballan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I like the docstrings. This is really solid.

I left a couple very minor comments, just to take the opportunity to teach some small things.


"""

if not os.path.exists("files/"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an optional argument to say "Create the directory only if it doesn't already exist." https://docs.python.org/3/library/os.html#os.makedirs

if not os.path.exists("files/"):
os.mkdir("files/")

for key in c['dataset'].keys():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is perfectly fine. It's useful to know that iterating through a dict-like object iterates through its keys, so you can just write:

Suggested change
for key in c['dataset'].keys():
for key in c['dataset']:

@dylanmcreynolds
Copy link
Contributor

Sorry, I missed this months ago. Is it still valid?

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

Successfully merging this pull request may close these issues.

3 participants