-
Notifications
You must be signed in to change notification settings - Fork 0
/
pjs_common.py
27 lines (22 loc) · 829 Bytes
/
pjs_common.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
import os
pjs_dir = os.path.dirname(os.path.realpath(__file__))
job_queue_file = os.path.join(pjs_dir, 'job_queue')
log_file = os.path.join(pjs_dir, 'scheduler.log')
pause_file = os.path.join(pjs_dir, 'AGENT_PAUSED')
running_file = os.path.join(pjs_dir, 'AGENT_RUNNING')
command_name=''.join(['single.py -c python ', os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)),
'pjs_agent.py')
)])
def read_job_from_line(line):
return [i.strip().lstrip('*# ') for i in line.split(',')]
def remake_list(infile, mark_done=False):
qfile = open(infile, 'w')
bakfile = open(infile + '.bak','r')
for line in bakfile:
if mark_done and line.startswith('#'):
line = '*' + line[1:]
qfile.write(line)
qfile.close()
bakfile.close()
return 0