begin writing params

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-16 19:06:43 +02:00
parent 5cefeb25fc
commit 8838d5df11
2 changed files with 18 additions and 5 deletions

View file

@ -608,6 +608,7 @@ def emulator():
type = os.path.basename(sys.argv[0]) type = os.path.basename(sys.argv[0])
type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type)
param_dir = os.path.join(type_dir, "parameter") param_dir = os.path.join(type_dir, "parameter")
global_dir = os.environ['__global']
parser = argparse.ArgumentParser(add_help=False) parser = argparse.ArgumentParser(add_help=False)
@ -625,23 +626,34 @@ def emulator():
if not os.path.isfile(os.path.join(type_dir, "singleton")): if not os.path.isfile(os.path.join(type_dir, "singleton")):
parser.add_argument("object_id", nargs=1) parser.add_argument("object_id", nargs=1)
else:
print("singleton")
# And finally verify parameter # And finally verify parameter
args = parser.parse_args(sys.argv[1:]) args = parser.parse_args(sys.argv[1:])
object_id = args.object_id # Setup object_id
if os.path.isfile(os.path.join(type_dir, "singleton")):
object_id = "singleton"
else:
object_id = args.object_id
del args.object_id
del args.object_id
print(args) print(args)
print(object_id)
param_out_dir = os.path.join(global_dir, type,
object_id, DOT_CDIST, "parameter")
# Record parameter # Record parameter
params = vars(args) params = vars(args)
for param in params: for param in params:
value = getattr(args, param) value = getattr(args, param)
if value: if value:
print("Writing " + param + " = " + value) file = os.path.join(param_out_dir, param)
print(file + "<-" + param + " = " + value)
param_fd = open(file)
param_fd.writelines(value)
param_fd.close()
# Record requirements # Record requirements

View file

@ -24,6 +24,7 @@
- what about type explorer? - what about type explorer?
- do not run, create empty output (types should be able - do not run, create empty output (types should be able
to handle this!) to handle this!)
via __global/
- Support parallel execution - Support parallel execution
- and maximum number of parallel runs (-p X) - and maximum number of parallel runs (-p X)