#! /usr/bin/env python

import logging
import os
import platform

from lab.calls.call import Call
from lab import tools

tools.configure_logging()

logging.info(f"node: {platform.node()}")

run_log = open("run.log", "w")
run_err = open("run.err", "w", buffering=1)  # line buffering
redirects = {"stdout": run_log, "stderr": run_err}

# Make sure we're in the run directory.
os.chdir(os.path.dirname(os.path.abspath(__file__)))

Call(['/proj/parground/users/x_dangn/numeric-fd/experiments/numeric-pdbs/.venv/bin/python', '/proj/parground/users/x_dangn/numeric-fd/experiments/numeric-pdbs/data/2024-12-17-aaai-crc/code-12fb9f81b03c2fea6d66c1b73e6db1cc1b8c98da_81dfaf3b/fast-downward.py', '--validate', '--overall-time-limit', '30m', '--overall-memory-limit', '3584M', '--overall-time-limit', '30m', '--build', 'release64', '--overall-memory-limit', '8G', 'domain.pddl', 'problem.pddl', '--search', 'astar(operatorcounting([lmcutnumeric_constraints(ceiling_less_than_one=true),state_equation_constraints],cplex,lp))'], hard_stderr_limit=10240, hard_stdout_limit=10240, memory_limit=None, name='planner', soft_stderr_limit=64, soft_stdout_limit=1024, time_limit=None, **redirects).wait()


for f in [run_log, run_err]:
    f.close()
    if os.path.getsize(f.name) == 0:
        os.remove(f.name)
