from slurm_utils import create_and_submit_batch_job
from datetime import datetime
import os
from pathlib import Path
import argparse

PROJECT_ROOT = Path(os.path.realpath(__file__)).parents[1]

parser = argparse.ArgumentParser()
parser.add_argument('--interactive', action='store_true')
args = parser.parse_args()

# DATA_DIR = 'uspto_full'
SCRIPT_DIR = 'scripts'
platform = 'lumi'
project = 'project_462000833'

slurm_args = {
    'job_dir': 'jobs',
    'job_ids_file': 'job_ids.txt',
    'output_dir': 'output',
    'platform': platform,
    'project': project,
    'time': '00:20:00',
    'partition': 'small',
    'nodes': 1,
    'ntasks-per-node': 1,
    'cpus-per-task': 1,
    'mem': '20G', # 50G not enough for uspto_full
    'with_containers': True,
    'container': 'multiguide-lumi.sif',
    'venv_path': 'multiguide-lumi-container',
    'start_array_job': 0, # 5 to 37
    'end_array_job': 0 #37
}
time_stamp = datetime.now().strftime("%Y%m%d_%H%M%S")
# NOTE: here should not modify any of the hydra configs manually...
# NOTE: unless maybe running ablations in a loop. For now define all configurations of params as experiment files.
script_args = {"script_dir": SCRIPT_DIR,
                "use_torchrun": 'false',
                "args": {'dataset': 'uspto_full'},
                "variables": {}}
script_args['script_name'] = 'sanity_check_on_uspto_full.py'
task = 'sanity_check_on_uspto_full'
slurm_args['job_name'] = task
output = create_and_submit_batch_job(slurm_args, script_args, interactive=args.interactive)