Skip to content

Commit

Permalink
Merge pull request #112 from GEOS-ESM/bugfix/jstassi/#111-Pass_altern…
Browse files Browse the repository at this point in the history
…ate_ARCHIVE_to_Pyradmon

Logic was added to pass the ARCHIVE location from GEOSadas to the Pyr…
  • Loading branch information
rtodling authored Oct 4, 2021
2 parents e70919b + 494ce0d commit 5a3234d
Showing 1 changed file with 43 additions and 14 deletions.
57 changes: 43 additions & 14 deletions src/Applications/GEOSdas_App/monthly.yyyymm.pl.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ use WriteLog qw(chdir_ mkpath_ unlink_ system_);
# global variables
#-----------------
my ($meansFLG, $plotsFLG, $radmonFLG, $tarFLG, $finish, $nopush, %doMeans);
my ($EXPID, $FVHOME, $PBS_BIN, $PYRADMON, $account, $listdir, $mnthlyRC);
my ($numnodes_mm, $numnodes_mp, $plotHISTrc, $qcmd, $rundir);
my ($EXPID, $FVARCH, $FVHOME, $PBS_BIN, $PYRADMON, $account, $listdir);
my ($mnthlyRC, $numnodes_mm, $numnodes_mp, $plotHISTrc, $qcmd, $rundir);
my ($script, $siteID, $workdir, $yyyymm, %newrc, %JOBID);
my ($walltime_cl, $walltime_mm, $walltime_mp, $walltime_pf);
my ($partition, $qos, $runlocal);
my ($datamove_constraint);

#$partition = "preops";
#$qos = "dastest";
$partition = "preops";
$qos = "dastest";

my %valid = ( "fetch" => 1,
"means" => 1,
Expand Down Expand Up @@ -165,10 +166,17 @@ sub init {
perl_config(%opts);

$EXPID = $ENV{"EXPID"};
$FVARCH = $ENV{"FVARCH"};
$FVHOME = $ENV{"FVHOME"};
$PBS_BIN = $ENV{"PBS_BIN"};
$PYRADMON = $ENV{"PYRADMON"};
$GID = $ENV{"GID"};
$datamove_constraint = $ENV{"datamove_constraint"};
$datamove_constraint = "#";
if ($datamove_constraint) {
$datamove_constraint = $datamove_constraint;
}


$ENV{"PATH"} = "$rundir:$fvroot/bin:$ENV{PATH}";

Expand Down Expand Up @@ -397,6 +405,7 @@ sub fetch_inputs {
my (%opts, $filestring, $ftype, $htype, $do_dmput, $do_tar);
my ($tmpl, $prefetch_j, $jobname, $outfile);
my ($job_name, $time, $output, $parFLG, $vFLG);
my ($constraint);
my (%value, @deps, $dependFLG, $cmd);

# input arguments
Expand All @@ -421,13 +430,15 @@ sub fetch_inputs {
$time = "SBATCH --time=$walltime_pf";
$output = "SBATCH --output=$outfile";
$parFLG = "SBATCH --partition=datamove";
$constraint = "$datamove_constraint";
$vFLG = "--export=outfile=$outfile";
}
else {
$job_name = "PBS -N $jobname";
$time = "PBS -l walltime=$walltime_pf";
$output = "PBS -o $outfile";
$parFLG = "";
$constraint = "";
$vFLG = "-v outfile=$outfile";
}

Expand All @@ -437,6 +448,7 @@ sub fetch_inputs {
$value{"__ACCOUNT__"} = $account;
$value{"__OUTPUT__"} = $output;
$value{"__PARTITION__"} = $parFLG;
$value{"__CONSTRAINT__"} = $constraint;

$value{"__FILESTRING__"} = $filestring;
$value{"__HOURTYPE__"} = $htype;
Expand Down Expand Up @@ -565,6 +577,7 @@ sub tar_and_clean_inputs {
my (%opts, $filestring, $ftype, $do_tar, $lastFLG);
my ($tmpl, $tarandclean_j, $jobname, $outfile);
my ($job_name, $time, $output, $parFLG, $vFLG);
my ($constraint);
my (%value, $walltime, @deps, $dependFLG, $cmd);

# input arguments
Expand All @@ -588,13 +601,15 @@ sub tar_and_clean_inputs {
$time = "SBATCH --time=$walltime_cl";
$output = "SBATCH --output=$outfile";
$parFLG = "SBATCH --partition=datamove";
$constraint = "$datamove_constraint";
$vFLG = "--export=outfile=$outfile";
}
else {
$job_name = "PBS -N $jobname ";
$time = "PBS -l walltime=$walltime_cl";
$output = "PBS -o $outfile";
$parFLG = "";
$constraint = "";
$vFLG = "-v outfile=$outfile";
}

Expand All @@ -604,6 +619,7 @@ sub tar_and_clean_inputs {
$value{"__ACCOUNT__"} = $account;
$value{"__OUTPUT__"} = $output;
$value{"__PARTITION__"} = $parFLG;
$value{"__CONSTRAINT__"} = $constraint;

$value{"__FILESTRING__"} = $filestring;
$value{"__YYYYMM__"} = $yyyymm;
Expand Down Expand Up @@ -639,6 +655,7 @@ sub tar_and_clean_inputs {
sub archive_monthly_keep_files {
my ($outfile, $vars, $vFLG, $outFLG, $qFLGs, @deps, $dependFLG);
my ($KEEParc_csh, $cmd, $cmd_save);
my ($constraint,$dummy);

# command flags
#--------------
Expand All @@ -648,10 +665,15 @@ sub archive_monthly_keep_files {
. "outfile=$outfile";

if ($siteID eq "nccs") {
$constraint = "";
if ($datamove_constraint) {
($dummy, $constraint) = (split / /, $datamove_constraint)[0, 1];
}
$constraint = "" unless $constraint;
$vFLG = "--export=$vars";
$outFLG = "--output=$outfile";
$qFLGs = "--job-name=KEEParc.$yyyymm --time=$walltime_cl"
. " --partition=datamove";
. " --partition=datamove $constraint";
}
else {
$vFLG = "-v $vars";
Expand Down Expand Up @@ -695,6 +717,7 @@ sub archive_monthly_keep_files {
sub archive_monthly_files {
my ($outfile, $vars, $vFLG, $outFLG, $qFLGs, @deps, $dependFLG);
my ($MPParc_csh, $cmd, $cmd_save);
my ($dummy, $constraint);

# command flags
#--------------
Expand All @@ -705,10 +728,15 @@ sub archive_monthly_files {
. "mmid=$$";

if ($siteID eq "nccs") {
$constraint = "";
if ($datamove_constraint) {
($dummy, $constraint) = (split / /, $datamove_constraint)[0, 1];
}
$constraint = "" unless $constraint;
$vFLG = "--export=$vars";
$outFLG = "--output=$outfile";
$qFLGs = "--job-name=MPParc.$yyyymm --nodes=1 --time=$walltime_cl"
. " --partition=datamove";
. " --partition=datamove $constraint";
}
else {
$vFLG = "-v $vars";
Expand Down Expand Up @@ -887,35 +915,36 @@ sub finish_monthly_plots {
# purpose - run pyradmon code
#=======================================================================
sub radmon {
my ($qFLG, $flags, $pyflags, $radmonRC);
my ($qFLG, $flags, $pyflags, $radmonRC, $pyradmon_driver_pl);

$qFLG = "";
$qFLG = "-qjobs" unless $runlocal;
$flags = "-expid $EXPID -fvhome $FVHOME -np $qFLG";
$flags = "-expid $EXPID -fvhome $FVHOME -archive $FVARCH -np $qFLG";

$pyradmon_driver_pl = "$PYRADMON/scripts/pyradmon_driver.pl";
$radmonRC = "$FVHOME/radmon/radmon.defaults.rc";
$radmonRC = "" unless -e $radmonRC;

if ($radmonFLG == 1) {
$pyflags = $flags ." -startdate ${yyyymm}01";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");
}
elsif ($radmonFLG == 2) {
$pyflags = $flags ." -startdate ${yyyymm}01 -enddate ${yyyymm}15";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");

$pyflags = $flags ." -startdate ${yyyymm}16";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");
}
elsif ($radmonFLG == 3) {
$pyflags = $flags ." -startdate ${yyyymm}01 -enddate ${yyyymm}10";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");

$pyflags = $flags ." -startdate ${yyyymm}11 -enddate ${yyyymm}20";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");

$pyflags = $flags ." -startdate ${yyyymm}21";
system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags");
system("$pyradmon_driver_pl $radmonRC $pyflags");
}
}

Expand Down

0 comments on commit 5a3234d

Please sign in to comment.