Skip to content

Commit

Permalink
_get_args returns args and _initialize initializes
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel Campoverde committed Dec 2, 2024
1 parent 706fb29 commit 512ca9c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/post_ap_scripts/job_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Interfaces.API.Job import Job
from DIRAC import initialize
from DIRAC import initialize as initialize_dirac
from DIRAC import gLogger

from tqdm import trange
Expand Down Expand Up @@ -40,7 +40,7 @@ def _get_job(jobid):

return j
# ---------------------------------------
def _get_args():
def _get_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description='Used to send filtering jobs to the grid')
parser.add_argument('-n', '--name' , type =str, help='Name of job, to identify it' , required=True)
parser.add_argument('-c', '--conf' , type =str, help='Type of filter, e.g. comp' , required=True)
Expand All @@ -52,19 +52,21 @@ def _get_args():

args = parser.parse_args()

return args
# ---------------------------------------
def _initialize() -> None:
args = _get_args()
Data.snd_dir = f'{os.getcwd()}/sandbox_{args.name}_{args.dset}_{args.conf}'
Data.name = args.name
Data.conf = args.conf
Data.dset = args.dset
Data.njob = args.njob
Data.venv = args.venv
Data.mode = args.mode
# ---------------------------------------
def _initialize() -> None:
_get_args()

os.makedirs(Data.snd_dir, exist_ok=False)
gLogger.setLevel('warning')
initialize()
initialize_dirac()

runner_path = files('post_ap_grid').joinpath('run_filter')
Data.runner_path = str(runner_path)
Expand Down

0 comments on commit 512ca9c

Please sign in to comment.