From 741ae6500bc57b8facc0347a95af454964eced21 Mon Sep 17 00:00:00 2001 From: John-Paul Robinson <jpr@uab.edu> Date: Mon, 29 Aug 2022 18:16:44 -0500 Subject: [PATCH] Create a base implementation of parsable files The policy file has both a LIST generation rule and a EXTERNAL LIST consumer rule. It uses the ESCAPE term to URL encode the ouput generated by the LIST. The external target script simply concats LIST files sent to it. The mmapplypolicy command adds an additonal variable JOBID to allow that to be passed as an OPT to the external script. This let's us distinguish the ouput of one job from the next. --- gather-info.sh | 23 +++++++++++++++++++++++ policy/list-path-external | 27 +++++++++++++++++++++++++++ run-mmpol.sh | 1 + 3 files changed, 51 insertions(+) create mode 100755 gather-info.sh create mode 100644 policy/list-path-external diff --git a/gather-info.sh b/gather-info.sh new file mode 100755 index 0000000..d5b5d61 --- /dev/null +++ b/gather-info.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# debug the calling convetion of the script +echo $@ >> data/call.log + +case $1 in + + LIST) + # just concat all file list files into a single file + # use opt parameter $3 as a tag to label the files + cat $2 >> data/listfile-${3}.log + rc=0 + ;; + + TEST) # Respond with success + rc=0 + ;; + + *) # Command not supported by this script + rc=1 + ;; +esac +exit $rc diff --git a/policy/list-path-external b/policy/list-path-external new file mode 100644 index 0000000..ff71573 --- /dev/null +++ b/policy/list-path-external @@ -0,0 +1,27 @@ +/* list of files to include */ +define( include_list, + (PATH_NAME LIKE 'FILEPATH%') +) + +/* define access_age */ +define(access_age, + (DAYS(CURRENT_TIMESTAMP) - DAYS(ACCESS_TIME)) +) + +RULE 'gather-exec' EXTERNAL LIST 'gather-info' EXEC '/data/rc/gpfs-policy/gather-info.sh' OPTS 'JOBID' ESCAPE '%' +RULE 'list-path' LIST 'gather-info' + SHOW ('|size=' || varchar(FILE_SIZE) || + '|kballoc='|| varchar(KB_ALLOCATED) || + '|access=' || varchar(ACCESS_TIME) || + '|create=' || varchar(CREATION_TIME) || + '|modify=' || varchar(MODIFICATION_TIME) || + '|uid=' || varchar(USER_ID) || + '|gid=' || varchar(GROUP_ID) || + '|heat=' || varchar(FILE_HEAT) || + '|pool=' || varchar(POOL_NAME) || + '|mode=' || varchar(MODE) || + '|misc=' || varchar(MISC_ATTRIBUTES) || + '|' + ) + WHERE include_list + diff --git a/run-mmpol.sh b/run-mmpol.sh index 1f1dfee..a78711b 100755 --- a/run-mmpol.sh +++ b/run-mmpol.sh @@ -24,6 +24,7 @@ cmd="mmapplypolicy ${filesystem} -I prepare \ -g $tmpglobal \ -s $tmpscratch \ -M FILEPATH=${filesystem} \ + -M JOBID=${SLURM_JOBID} \ -N ${nodes} -n ${cores}" # report final command in job log -- GitLab