forked from databrickslabs/migrate
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmap.py
More file actions
34 lines (27 loc) · 1.61 KB
/
map.py
File metadata and controls
34 lines (27 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
from utils.create_workspace import Workspace as Workspace
def main():
# checkpoints are optional for export but you will need to use them for the import
# (each workspace is a 'checkpoint')
# takes two arguments: checkpoint and workspaces
all_args = argparse.ArgumentParser()
all_args.add_argument("--checkpoint", dest="checkpoint", default="", help="set if you are using a checkpoint during export")
all_args.add_argument("--workspaces", dest="workspaces", nargs="+", required=True, help="list of workspace names. must match columns in asset_mapping.xslx.")
all_args.add_argument('--default-job-owner', dest="default_job_owner", default=False, help="set if you want to add a job owner to jobs that drop untagged owners.")
all_args.add_argument('--tag', dest="tag", default='Y', help="tag used in asset_mapping.xslx.")
args = all_args.parse_args()
checkpoint = args.checkpoint
workspaces = args.workspaces
default_owner = args.default_job_owner
tag = args.tag
# for each workspace
for w in workspaces:
# create a workspace Class - refer to create_workspace.py
# this instantiates the original location of the session and the new location of the session
# it also instantiates another class Split - refer to split_logs.py
# Split instantiates the same thing as well as two variables: imported users and imported groups (this is used for remaking ACLs)
workspace = Workspace(checkpoint, w, workspaces, default_owner, tag)
success = workspace.run()
workspace.copy_other_files()
if __name__ == "__main__":
main()