-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmf_mesos_setting.py
55 lines (42 loc) · 1.33 KB
/
mf_mesos_setting.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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# This module defined global variables and classes
# used by mf_mesos_scheduler.py
import os
import Queue
import threading
# variables need to be synchronized between threads
tasks_info_dict = {}
executors_info_dict = {}
lock = threading.RLock()
offers_queue = Queue.Queue()
# default makeflow working directory
mf_wk_dir = "."
DEBUG_FILE = "debug_mesos"
SLEEP = 0
def print_task_id_state():
if os.path.isfile(DEBUG_FILE):
debug_fn = open(DEBUG_FILE, "a+")
else:
debug_fn = open(DEBUG_FILE, "w+")
if len(tasks_info_dict) > 0:
for value in tasks_info_dict.itervalues():
debug_fn.write("{}:{},".format(value.task_id, value.action))
debug_fn.write("================\n")
debug_fn.close()
# Makeflow Mesos task info class
class MfMesosTaskInfo:
def __init__(self, task_id, cmd, inp_fns, oup_fns, action):
self.task_id = task_id
self.cmd = cmd
self.inp_fns = inp_fns
self.oup_fns = oup_fns
self.action = action
self.executor_id = None
# Makeflow Mesos executor info class
class MfMesosExecutorInfo:
def __init__(self, executor_id, slave_id, hostname):
self.executor_id = executor_id
self.slave_id = slave_id
self.hostname = hostname
self.state = "init"
self.tasks = []