Commit e2038324 authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

Feature #850 en cours

parent db32e435
......@@ -51,7 +51,14 @@ import sys
import datetime
def get_log_file (pipe, name):
"""
""" Return log file name
Current date time is prepend to the log file name.
Parameters
----------
pipe: pipe instance
name: log file short name
"""
d = datetime.datetime.now()
strdate = d.strftime("%y%m%d_%H%M%s%f")
......
......@@ -113,7 +113,12 @@ class Pipeline:
self.repository = LocalRepository(code_dir)
## string, indicates where to save the pipeline products.
self._prefix = prefix
if not os.path.exists(prefix):
os.mkdir(prefix)
logdir = os.path.join(prefix, "log")
if not os.path.exists(logdir):
os.mkdir(logdir)
## dict, directory corresponding to each segment
self._curr_dirs = {}
## dict, hash key corresponding to each segment
......
......@@ -235,17 +235,17 @@ def create_pipe(pipename, prefix=[]):
os.mkdir(code_dir)
## make prefix and log dir
if prefix:
if not os.path.exists(prefix):
os.mkdir(prefix)
else:
prefix = code_dir
logdir = os.path.join(prefix, "log")
if not os.path.exists(logdir):
os.mkdir(logdir)
if not prefix:
prefix= code_dir
if not os.path.exists(os.path.join(code_dir, "main.py")):
shutil.copy(current_dir+"/static/main.py", code_dir) ## make a main file with some doc
fn = current_dir+"/static/main.py"
with closing(file(fn, 'r')) as f:
str = f.read()
str = str.replace("prefix = './'", "prefix = '%s'"%prefix)
fn = os.path.join(code_dir, "main.py")
with closing(file(fn, 'w')) as f:
f.write(str)
if not os.path.exists(os.path.join(code_dir, "seg_default_code.py")):
shutil.copy(current_dir+"/static/seg_default_code.py", code_dir) ## make a segment file with some doc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment