-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelan_tools.py
executable file
·32 lines (24 loc) · 1.14 KB
/
elan_tools.py
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
import sys
import argparse
import daemons
import requests
from config import elan_key,elan_uri,project_workdir,project_backup,admin_mail
from elan_objects import Elan
#Daemons
def updateProjectDirectories(args):
daemons.update_project_directories.run(elan, project_workdir)
def manageBackup(args):
daemons.manage_backup.run(elan,project_workdir, project_backup,admin_mail)
if __name__ == "__main__":
elan = Elan(elan_uri, elan_key)
parser = argparse.ArgumentParser()
subparser = parser.add_subparsers()
#Daemon parsers
parser_daemons = subparser.add_parser('daemons', help='Daemon scripts: update_projects')
subparser_daemons = parser_daemons.add_subparsers()
parser_update_projects = subparser_daemons.add_parser('update_projects', help='Update the project directories with information from the elabjournal')
parser_update_projects.set_defaults(func=updateProjectDirectories)
parser_manage_backup = subparser_daemons.add_parser('manage_backup', help='Run backup daemon')
parser_manage_backup.set_defaults(func=manageBackup)
args = parser.parse_args()
args.func(args)