#!/usr/bin/env scons
"""
The master SConstruct file; particular analyses run via SConscript files in
subdirectories.
"""

import os

from os.path import join

import SCons.Script as sc

# Command line options
sc.AddOption('--pipe', type='string', help="Which pipeline to run.", default='pipe_main')
sc.AddOption('--data', type='string', help="Path to JSON describing data set. Default means use in-repo data.", default='sample_data/sample.json')
sc.AddOption(
    '--mode', type='string', help="The mode of the run, which is up to the SConscript to define.", default='default')
sc.AddOption('--clusters', type='string', help="Clusters to submit to. Default is local execution.", default='')
sc.AddOption('--test-size', type=float, help="Proportion of sample to hold out for testing.", default=0.5)

# Set up environment and run  \m/ ( -_- ) \m/
env = sc.Environment(
    ENV=os.environ,
    data=sc.GetOption('data'),
    mode=sc.GetOption('mode'),
    clusters=sc.GetOption('clusters'),
    test_size=sc.GetOption('test_size'))
sc.Export('env')
sc.SConscript(join(sc.GetOption('pipe'), 'SConscript'))
