runlocal: always use abspath for paths
Close
@@ -35,12 +35,14 @@ def get_metrics_command(dry_run=False):
def setup_local(algo_path,
- train_opener_path, test_opener_path,
+ train_opener_path,
+ test_opener_path,
metric_file_path,
- train_data_sample_path, test_data_sample_path,
- outmodel_path='./',
- compute_path='./sandbox',
- local_path='local'):
+ train_data_sample_path,
+ test_data_sample_path,
+ outmodel_path,
+ compute_path,
+ local_path):
config = {}
@@ -49,8 +51,8 @@ def setup_local(algo_path,
config['train_opener_file'] = os.path.abspath(train_opener_path)
config['test_opener_file'] = os.path.abspath(test_opener_path)
- config['train_data_path'] = train_data_sample_path
- config['test_data_path'] = test_data_sample_path
+ config['train_data_path'] = os.path.abspath(train_data_sample_path)
+ config['test_data_path'] = os.path.abspath(test_data_sample_path)
config['metrics_file'] = os.path.abspath(metric_file_path)
# check config values
@@ -244,15 +246,15 @@ class RunLocal(Base):
def run(self):
+ def _get_path(base_path, relpath):
+ return os.path.abspath(os.path.join(base_path, relpath))
+
def _get_option(option_name, default):
option = self.options.get(option_name)
if option is None:
return default
return option
- def _get_path(base_path, relpath):
- return os.path.abspath(os.path.join(base_path, relpath))
-
algo_path = self.options['<algo-path>']
train_opener = _get_option('--train-opener',
@@ -283,12 +285,18 @@ class RunLocal(Base):
train_data = None
test_data = None
+ compute_path = './sandbox'
+ local_path = 'local'
+
config = setup_local(algo_path,
- train_opener, test_opener, metrics,
- train_data, test_data,
- outmodel_path=outmodel,
- compute_path='./sandbox',
- local_path='local')
+ train_opener,
+ test_opener,
+ metrics,
+ train_data,
+ test_data,
+ outmodel,
+ compute_path,
+ local_path)
client = docker.from_env()
