-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optionally run specified rocoto task as part of the ctests (#1121)
Only tested with the coupled UFS and the marine DA tasks: ``` Test project /scratch1/NCEPDEV/stmp2/Guillaume.Vernieres/runs/prs/global-workflow/sorc/gdas.cd/build/gdas/test/gw-ci Test #1: C48mx500_3DVarAOWCDA Test #2: C96_atmaerosnowDA Test #3: C96C48_ufs_hybatmDA Test #4: C48mx500_3DVarAOWCDA_gdasfcst_202103241200 Test #5: C48mx500_3DVarAOWCDA_gdasprepoceanobs_202103241800 Test #6: C48mx500_3DVarAOWCDA_gdasocnanalprep_202103241800 Test #7: C48mx500_3DVarAOWCDA_gdasocnanalbmat_202103241800 Test #8: C48mx500_3DVarAOWCDA_gdasocnanalrun_202103241800 Test #9: C48mx500_3DVarAOWCDA_gdasocnanalchkpt_202103241800 Test #10: C48mx500_3DVarAOWCDA_gdasocnanalpost_202103241800 Total Tests: 10 ```
- Loading branch information
1 parent
52dfb5f
commit af7fb73
Showing
4 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import re | ||
import argparse | ||
from datetime import datetime, timedelta | ||
|
||
|
||
def read_idate_from_yaml(file_path): | ||
idate_value = None | ||
with open(file_path, 'r') as file: | ||
for line in file: | ||
match = re.search(r'^\s*idate:\s*(.*)', line) | ||
|
||
if match: | ||
idate_value = match.group(1).strip() | ||
break | ||
return idate_value | ||
|
||
|
||
def format_dates(idate_str): | ||
date_obj = datetime.strptime(idate_str, '%Y%m%d%H') | ||
half_cycle = date_obj.strftime('%Y%m%d%H%M') | ||
new_date_obj = date_obj + timedelta(hours=6) | ||
full_cycle = new_date_obj.strftime('%Y%m%d%H%M') | ||
|
||
return half_cycle, full_cycle | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description="Extract and format idate.") | ||
parser.add_argument('yaml_file', help="Path to exp.yaml file") | ||
args = parser.parse_args() | ||
|
||
idate_value = read_idate_from_yaml(args.yaml_file) | ||
half_cycle, full_cycle = format_dates(idate_value) | ||
print(f"{half_cycle},{full_cycle}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
pslot=$1 | ||
TASK_NAME=$2 | ||
CYCLE=$3 | ||
|
||
# Define the workflow XML and database files | ||
WORKFLOW_XML=${pslot}/EXPDIR/${pslot}/${pslot}.xml | ||
WORKFLOW_DB=${pslot}/EXPDIR/${pslot}/${pslot}.db | ||
|
||
# Boot the task | ||
echo "booting $TASK_NAME for cycle $CYCLE" | ||
if [[ ! -e "$WORKFLOW_DB" ]]; then | ||
rocotorun -w "$WORKFLOW_XML" -d "$WORKFLOW_DB" -t "$TASK_NAME" -c "$CYCLE" | ||
fi | ||
rocotoboot -w "$WORKFLOW_XML" -d "$WORKFLOW_DB" -t "$TASK_NAME" -c "$CYCLE" | ||
|
||
while true; do | ||
# Update the status of the task | ||
rocotorun -w "$WORKFLOW_XML" -d "$WORKFLOW_DB" -t "$TASK_NAME" -c "$CYCLE" | ||
|
||
# Check the task status | ||
OUTPUT=$(rocotostat -w "$WORKFLOW_XML" -d "$WORKFLOW_DB" -t "$TASK_NAME" -c "$CYCLE") | ||
STATUS=$(echo "$OUTPUT" | awk '$2 == task {print $4}' task="$TASK_NAME") | ||
|
||
if [[ "$STATUS" == "SUCCEEDED" ]]; then | ||
echo "The task succeeded." | ||
exit 0 | ||
elif [[ "$STATUS" == "FAILED" ]]; then | ||
echo "The task failed." | ||
exit 1 | ||
elif [[ "$STATUS" == "DEAD" ]]; then | ||
echo "The task is dead." | ||
exit 1 | ||
else | ||
echo "The task is in state: $STATUS" | ||
fi | ||
sleep 10 | ||
done |