Skip to content
Snippets Groups Projects
Commit fc0e63fc authored by lockloss's avatar lockloss
Browse files

fix bug in lock checking

parent 4e4b9c16
No related branches found
No related tags found
No related merge requests found
......@@ -167,14 +167,17 @@ RETRY {jid} 1
logging.info("condor DAG {} jobs".format(jid+1))
return s
@property
def lock(self):
return os.path.join(self.condor_dir, 'dag.lock')
@property
def has_lock(self):
lock = os.path.join(self.condor_dir, 'dag.lock')
return os.path.exists(lock)
return os.path.exists(self.lock)
def write(self):
if self.has_lock:
raise RuntimeError("DAG already running: {}".format(lock))
raise RuntimeError("DAG already running: {}".format(self.lock))
shutil.rmtree(self.condor_dir)
try:
os.makedirs(os.path.join(self.condor_dir, 'logs'))
......@@ -187,7 +190,7 @@ RETRY {jid} 1
def submit(self):
assert os.path.exists(self.dag_path), "Must write() before submitting"
if self.has_lock:
raise RuntimeError("DAG already running: {}".format(lock))
raise RuntimeError("DAG already running: {}".format(self.lock))
logging.info("condor submit dag: {}".format(self.dag_path))
subprocess.call(['condor_submit_dag', self.dag_path])
print("""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment