Re: [gpfsug-discuss] gpfsug-discuss Digest, Vol 108, Issue 18
Jonathan, If I have a single policy file with all the related department rules and each time they want to add additional rules with different working day thresholds maybe using this -M method is easier. Its clear that the 'maths' and date/timestamp manipulation is easier in shell (my preferred is bash) than in the SQL of the policy (your example is succinct but needs to be repeated everytime a new rule is added with a different working day threshold, which is what I'm trying (if possiblr) to avoid. It seems to me the IBM SQL engine is perhaps missing more 'SQL' in built date/time functions like DateAdd and DateDiff etc.. as this would be a moot point. Its a shame I can't make one function that given a working day input as an argument spits out how many 'real' days exist between them for the file age comparison all in the SQL. It can be done for 1 specific input argument, but needs the whole function repeated manually for a different input argument, and further repeated for a different argument etc.. Maybe I'm also compounding the issue by trying to make the policy file as concise as possible (for sake of clarity as to what the rules are trying to achieve, and easy expandability), and demanding too much of the SQL-like syntax that IBM have created. I have options for mmfind or even (as suggested) -M inoput to mmapplypolicy where I us bash to create a small function that does what I need, spits out 'real days' given a working day input, and using arrays and for-loop create a dynamic calling of the mmapplypolicy command (which I'm kinda half doing anyways for other reasons in my launcher script. As always, I'm seriously amazed at people with soo much experience and knowledge taking time out to help, guide, and offer input like everyone has been doing!! I'm relatively early in my career, so being able to interact and learn from experienced persons is giving me such a wider insight! Thanks! Owen. [Sent from Front] On 1 February 2021, 20:17 GMT jonathan.buzzard@strath.ac.uk<mailto:jonathan.buzzard@strath.ac.uk> wrote: On 01/02/2021 18:11, Jan-Frode Myklebust wrote:
CAUTION: This email originated outside the University. Check before clicking links or attachments. Agree.. Write a policy that takes a "mmapplypolicy -M var=val" argument, and figure out the workdays outside of the policy. Something like:
# cat test.poilcy define( access_age, (DAYS(CURRENT_TIMESTAMP) - DAYS(ACCESS_TIME))) /* list migrated files */ RULE EXTERNAL LIST 'oldFiles' EXEC '' RULE 'oldFiles' LIST 'oldFiles' WHERE (access_age > MINAGE)
# mmapplypolicy gpfs01 -P test.policy -I defer -f ./filelist -M MINAGE=5
Why bother when you can do it all in the policy? JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG Owen Morgan Data Wrangler Motion Picture Solutions Ltd T: E: owen.morgan@motionpicturesolutions.com | W: motionpicturesolutions.com A: Mission Hall, 9-11 North End Road, London, W14 8ST Motion Picture Solutions Ltd is a company registered in England and Wales under number 5388229, VAT number 201330482
Hi Owen, This is a great thread and raises as is usual with GPFS that there is more often than not many tools in the bag and more than one way to achieve a requirement. If you stick with policy (indeed worthwhile aspect of GPFS to learn well) you can also build up libraries of centralised macros and reference them into any policy file alike so at the top of the file: include(/mmfs1/policies/macros/general_macros.m4) include(/mmfs1/policies/macros/pixit_excludes.m4) Check your PixStor system under /mmfs1/policies/.. The .m4 extension is not required, but a nod to https://www.gnu.org/savannah-checkouts/gnu/m4/manual/m4-1.4.18/m4.html which the policy engine also encapsulates. Marc Kaplan once told me "You can do just about anything with m4 and cleverness and patience...", though he failed to mention the required amounts of coffee and pizza ;-) Search the list digests for his valuable insights over the years. Alternatively you can achieve all this and more using the Python API https://www.arcapix.com/pixstorapi/index.html (especially your date processing). If you'd like direct support with any this, ping us over an email via support@ - alternatively there are indeed many great minds a wealth of experience and views on this list (and it's nice to meet the community too). SSUG also has a Slack channel too.. ssug-poweraiug.slack.com Most of all - have fun learning. Kind regards, Jez p.s. yes the threading has all gone wonky. ah well :-) On 01/02/2021 21:09, Owen Morgan wrote:
Jonathan,
If I have a single policy file with all the related department rules and each time they want to add additional rules with different working day thresholds maybe using this -M method is easier. Its clear that the 'maths' and date/timestamp manipulation is easier in shell (my preferred is bash) than in the SQL of the policy (your example is succinct but needs to be repeated everytime a new rule is added with a different working day threshold, which is what I'm trying (if possiblr) to avoid.
It seems to me the IBM SQL engine is perhaps missing more 'SQL' in built date/time functions like DateAdd and DateDiff etc.. as this would be a moot point. Its a shame I can't make one function that given a working day input as an argument spits out how many 'real' days exist between them for the file age comparison all in the SQL. It can be done for 1 specific input argument, but needs the whole function repeated manually for a different input argument, and further repeated for a different argument etc..
Maybe I'm also compounding the issue by trying to make the policy file as concise as possible (for sake of clarity as to what the rules are trying to achieve, and easy expandability), and demanding too much of the SQL-like syntax that IBM have created.
I have options for mmfind or even (as suggested) -M inoput to mmapplypolicy where I us bash to create a small function that does what I need, spits out 'real days' given a working day input, and using arrays and for-loop create a dynamic calling of the mmapplypolicy command (which I'm kinda half doing anyways for other reasons in my launcher script.
As always, I'm seriously amazed at people with soo much experience and knowledge taking time out to help, guide, and offer input like everyone has been doing!! I'm relatively early in my career, so being able to interact and learn from experienced persons is giving me such a wider insight!
Thanks!
Owen. Sent from Front
Owen Morgan Data Wrangler Motion Picture Solutions Ltd T: ** <tel:>
E: *owen.morgan@motionpicturesolutions.com* <mailto:owen.morgan@motionpicturesolutions.com> | W: *motionpicturesolutions.com* <https://www.motionpicturesolutions.com/>
A: Mission Hall, 9‑11 North End Road , London , W14 8ST
Motion Picture Solutions Ltd is a company registered in England and Wales under number 5388229, VAT number 201330482
On 1 February 2021, 20:17 GMT jonathan.buzzard@strath.ac.uk <mailto:jonathan.buzzard@strath.ac.uk> wrote:
On 01/02/2021 18:11, Jan-Frode Myklebust wrote:
CAUTION: This email originated outside the University. Check before clicking links or attachments. Agree.. Write a policy that takes a "mmapplypolicy -M var=val" argument, and figure out the workdays outside of the policy. Something like:
# cat test.poilcy define( access_age, (DAYS(CURRENT_TIMESTAMP) - DAYS(ACCESS_TIME))) /* list migrated files */ RULE EXTERNAL LIST 'oldFiles' EXEC '' RULE 'oldFiles' LIST 'oldFiles' WHERE (access_age > MINAGE)
# mmapplypolicy gpfs01 -P test.policy -I defer -f ./filelist -M MINAGE=5
Why bother when you can do it all in the policy?
JAB.
-- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
_______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
-- *Jez Tucker* VP Research and Development | Pixit Media m: +44 (0) 776 419 3820 e: jtucker@pixitmedia.com <mailto:jtucker@pixitmedia.com> Visit www.pixitmedia.com <https://www.pixitmedia.com> -- This email is confidential in that it is intended for the exclusive attention of the addressee(s) indicated. If you are not the intended recipient, this email should not be read or disclosed to any other person. Please notify the sender immediately and delete this email from your computer system. Any opinions expressed are not necessarily those of the company from which this email was sent and, whilst to the best of our knowledge no viruses or defects exist, no responsibility can be accepted for any loss or damage arising from its receipt or subsequent use of this email.
On 01/02/2021 21:09, Owen Morgan wrote:
CAUTION: This email originated outside the University. Check before clicking links or attachments. Jonathan,
If I have a single policy file with all the related department rules and each time they want to add additional rules with different working day thresholds maybe using this -M method is easier. Its clear that the 'maths' and date/timestamp manipulation is easier in shell (my preferred is bash) than in the SQL of the policy (your example is succinct but needs to be repeated everytime a new rule is added with a different working day threshold, which is what I'm trying (if possiblr) to avoid.
I actually think there is a much better way to achieve it than the case statement, but that would have required me to do some more thinking and testing to make sure it worked ;-) Anyway how many different "working" days old do you need? JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
In our environment managing the GPFS policies (or anything GPFS) are a bit of an Art form and really only a few people out of a sea of engineers can/will do it. So I like to keep the GPFS policies simple and durable. If you really wanted to you could generate a list of every US (or whatever country) holiday you wanted and use Python, Awk, whatever to produce an exact number of business days versus not; You can also use directory structure, GPFS attributes in parent directory, or a config file to maintain the requirements, which may be more manageable by other team members. Anyhow my point being don't just look at the technical of how to implement, but what is the most maintainable, .documentable, and recoverable solution. Some things I would consider in my design? * Supportability - What is the skill level of the engineer required to maintain the system. * Serviceability - What component would change most frequently, what's the complexity and impact of a change. * Fail Safe - If a component fails, what will the negative impact be. * Trackability - Are all the activities logged. * Sanity Checking - Can you define safety mechanisms to prevent a failure. For instance if your purge script detects that there are 10k+ files to purge, can you interrupt the process? For GPFS we try to keep the service components simple, and the logic in shell scripting where there is a plethora of knowledgeable engineers. So my attack would be like this: * Policy runs, purges any file with purgeafter beyond the current date (maybe validate that the purge.date and modify/access date agree still). <-- is simple * I would have it run the logic twice, and bomb if a safety threshhold is exceeded. Should log the results. * Config in /gpfs/configs/purge_configuration /some/path 10bd /some/scratchspace 30d /some/reallybigfiles 1d * mmfind $(awk '{print $1}' < gpfs/configs/purge_configuration) -type f --exec /gpfs/scripts/setpurgedates * Could also be a regular mmapplypolicy command as well... * /gpfs/scripts/setpurgedates can rescan /gpfs/configs/purge_configuration and read in the date, check against the path passed, and then perform the necessary date logic, and exec the mmchattr, preserve the file's modify/access time to a purge.date time.. * Could log its decisions to a log file. Happy Hunting, I've already learned quite a few things from monitoring this list in a very short period of time. * If a candidate ever tells me they know everything about Unix... I pass. We're all very experienced noobies in this ever progressing field/platform. * Alec On Mon, Feb 1, 2021 at 1:58 PM Jonathan Buzzard < jonathan.buzzard@strath.ac.uk> wrote:
On 01/02/2021 21:09, Owen Morgan wrote:
CAUTION: This email originated outside the University. Check before clicking links or attachments. Jonathan,
If I have a single policy file with all the related department rules and each time they want to add additional rules with different working day thresholds maybe using this -M method is easier. Its clear that the 'maths' and date/timestamp manipulation is easier in shell (my preferred is bash) than in the SQL of the policy (your example is succinct but needs to be repeated everytime a new rule is added with a different working day threshold, which is what I'm trying (if possiblr) to avoid.
I actually think there is a much better way to achieve it than the case statement, but that would have required me to do some more thinking and testing to make sure it worked ;-)
Anyway how many different "working" days old do you need?
JAB.
-- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
participants (4)
-
Alec -
Jez Tucker -
Jonathan Buzzard -
Owen Morgan
