-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemma_worker.py
More file actions
42 lines (36 loc) · 1.19 KB
/
emma_worker.py
File metadata and controls
42 lines (36 loc) · 1.19 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
35
36
37
38
39
40
41
42
#!/usr/bin/python3
# ----------------------------------------------------
# Electromagnetic Mining Array (EMMA)
# Worker node using Celery
# Copyright 2017, Pieter Robyns
# ----------------------------------------------------
from __future__ import absolute_import
from celery import Celery
import configparser
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Ignore Tensorflow deprecation and performance warnings
# os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # Do not use GPU
try:
settings = configparser.RawConfigParser()
settings.read('settings.conf')
broker = settings.get("Network", "broker")
print(broker)
backend = settings.get("Network", "backend")
print(backend)
except FileNotFoundError:
print("No settings.conf found! Please create it before running EMMA.")
exit(1)
app = Celery('emma',
broker=broker,
backend=backend,
include=['ops', 'action'])
# Optional configuration, see the application user guide.
app.conf.update(
task_serializer='pickle',
task_compression='zlib',
accept_content={'pickle'},
result_serializer='pickle',
# worker_max_tasks_per_child=1
)
if __name__ == '__main__':
app.start()