Hi Everyone,

First question from me I appreciate this is policy engine thing as opposed to 
more fundamental Spectrum Scale so hope its ok!

I'm trying to find a 'neat' way within a couple of policy rules to measure 
different time intervals (in days) but solely interested in WEEK DAYS only (ie 
delete files older than X week days only).

An example is one of the rules a team would like implemented is delete all 
files older than 10 business days (ie week days only. We are ignoring public 
holidays as if they don't exist). Followed by a separate rule for a different 
folder of deleting all files older than 4 business days.

The only way I've been able to facilitate this so far for the 4 business days 
is to separate out Fridays as a separate rule (because Friday - 4 days are all 
week days), then a separate rule for Monday through Thursday (because timestamp 
- 4 days has to factor in weekends, so has to actually set the INTERVAL to 6 
days). Likewise for the 10 days rule I have to have a method to separate out 
Monday - Wednesday, and Thursday and Friday.

I feel my 'solution', which does work, is extremely messy and not ideal should 
they want to add more rules as it just makes the policy file very long full of 
random definitions for all the different scenarios.

So whilst the 'rules' are simple thanks to definitions, its the definitions 
themselves that are stacking up... depending on the interval required I have to 
create a unique set of is_weekday definitions and unique is_older_than_xdays 
definitions.

here is a snippet of the policy:

define(
is_older_than_4days,
(
(CURRENT_TIMESTAMP - CREATION_TIME) >= INTERVAL '4' DAYS
)
)

define(
is_older_than_6days,
(
(CURRENT_TIMESTAMP - CREATION_TIME) >= INTERVAL '6' DAYS
)
)

define(
is_weekday_ex_fri,
(
DAYOFWEEK(CURRENT_DATE) IN (2,3,4,5)
)
)

define(
is_weekday_ex_fri,
(
DAYOFWEEK(CURRENT_DATE) = 6
)
)

RULE 'rule name' WHEN is_weekday_ex_fri DELETE
WHERE
include_list /* an include list just not added above */
AND is_older_than_6days

RULE 'rule name' WHEN is_fri DELETE
WHERE
include_list /* an include list just not added above */
AND is_older_than_4days

Are there any 'neat' other ways that are a tad more 'concise' for calculating 
INTERVAL X weekdays only which is easily and concisely extendable for any 
permutation of intervals required.

I'm not sure how much SQL you can shoehorn into a policy before mmapplypolicy / 
policy engine isn't happy.

Thanks in advance,

Owen.
[Sent from Front]

Owen Morgan
Data Wrangler
Motion Picture Solutions Ltd
T: 
E: [email protected] | 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
_______________________________________________
gpfsug-discuss mailing list
gpfsug-discuss at spectrumscale.org
http://gpfsug.org/mailman/listinfo/gpfsug-discuss

Reply via email to