Skip to content

Commit

Permalink
Use absolute file paths while running experiments.
Browse files Browse the repository at this point in the history
Otherwise, tilde or relative paths may not be parsed correctly by SLURM.
  • Loading branch information
musically-ut committed Oct 3, 2018
1 parent 7b97aa4 commit 1fccd59
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sbatch/exp_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def run(in_csv, user_data_file, dry, epochs, k, mem, reward_kind, output_dir, un
else:
with_zero_wt_str = '--no-with-zero-wt'

user_data_file_abs = os.path.abspath(user_data_file)

for row_idx, row in df.iterrows():
stdout_file = f'{output_dir}/stdout/user_idx-{row.idx}.%j.out'

Expand All @@ -52,12 +54,12 @@ def run(in_csv, user_data_file, dry, epochs, k, mem, reward_kind, output_dir, un

if reward_kind == 'top_k_reward':
cmd = (f'sbatch -c 2 --mem={mem} -o "{stdout_file}" ' +
f'./top_k_job.sh {user_data_file} {row.idx} "{output_dir}" ' +
f'./top_k_job.sh {user_data_file_abs} {row.idx} "{output_dir}" ' +
f'{N} {q} {until} {epochs} {k} {save_every} ' +
f'{algo_feed_str} {algo_approx_str} {with_zero_wt_str}')
elif reward_kind == 'r_2_reward':
cmd = (f'sbatch -c 2 --mem={mem} -o "{stdout_file}" ' +
f'./r_2_job.sh {user_data_file} {row.idx} "{output_dir}" ' +
f'./r_2_job.sh {user_data_file_abs} {row.idx} "{output_dir}" ' +
f'{N} {q} {until} {epochs} {save_every} ' +
f'{algo_feed_str} {algo_approx_str} {with_zero_wt_str}')
else:
Expand Down

0 comments on commit 1fccd59

Please sign in to comment.