-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaintainer.py
42 lines (33 loc) · 1.34 KB
/
maintainer.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
33
34
35
36
37
38
39
40
41
42
"""
The module that contains all the necessary logic for processing jobs in the database queue.
This has to be adopted on each instance to fit the specific needs of the experiment.
"""
import logging
from decouple import config
# import the storage provider that you would like to use
# currently we have dropbox and mongodb
from sqooler.storage_providers.mongodb import MongodbProvider
from sqooler.schemes import MongodbLoginInformation
from sqooler.utils import update_backends, main
from config import spooler_object # pylint: disable=import-error
# configure the backends that are accessible to the maintainer
# typicall this is the spooler object from the experiment and only one backend is needed here.
backends = {
"mot": spooler_object,
}
# configure the storage provider
mongodb_username = config("MONGODB_USERNAME")
mongodb_password = config("MONGODB_PASSWORD")
mongodb_database_url = config("MONGODB_DATABASE_URL")
login_dict = {
"mongodb_username": mongodb_username,
"mongodb_password": mongodb_password,
"mongodb_database_url": mongodb_database_url,
}
mongodb_login = MongodbLoginInformation(**login_dict)
storage_provider = MongodbProvider(mongodb_login)
logging.basicConfig(level=logging.INFO)
logging.info("Update")
update_backends(storage_provider, backends)
logging.info("Now run as usual.")
main(storage_provider, backends)