o e8@s:ddlZddlZddlZddZddZGdddZdS)Ncs fddtdtDS)Nc3s |] }||VqdSN).0posseqsizer=/lfs/h1/ops/prod/packages/epoch.v1.0.5/ush/epochinputstate.py szchunker..r)xrangelenrrrr chunkers r cCs|||r |||S|Sr) has_optionget)configsectionnamedefaultrrr getWithDefaults  rc@sneZdZddZddZddZddZd d Zd d ZdddZ ddZ ddZ ddZ ddZ ddZdS)EpochInputStatecCs(d|_d|_g|_g|_g|_g|_dS)Nznot setF) _statefile_ok_LIR_GFS_CMORPH _RAW_CMORPH)selfrrr __init__s  zEpochInputState.__init__cCs||_d|_tj|rxtjtjdd}||jt |ddg}|r)| |_ ng|_ t |ddg}|r;| |_ ng|_ t |ddg}|rM| |_ ng|_ t |ddg}|r_| |_ng|_|j |j|j |j dStd |jg|_g|_ g|_ g|_ dS) NTF)strictZinputsGFSZCMORPHZ RAW_CMORPHLIRz<----State file does not exist, initialize to empty state----)rrospathexists configparser ConfigParserenvironreadrsplitrrrrsortprint)r statefileparserlrrr readOrCreate's<          zEpochInputState.readOrCreatecC,|t|jvr|j||jdSdSr)strrappendr)rymdhrrr updateGFST zEpochInputState.updateGFScCr/r)r0rr1r)rymdhmrrr updateCMORPHYr5zEpochInputState.updateCMORPHcCr/r)r0rr1r)r6rrr updateRawCMORPH^r5zEpochInputState.updateRawCMORPHcCr/r)r0rr1r)r2rrr updateLIRcr5zEpochInputState.updateLIRFcCst|d}|d|d|jD] }|d|dq|d|jD] }|d|dq&|d|jD] }|d|dq:|d|jD] }|d|dqN||rgtd |dSdS) Nwz [inputs] zGFS=  z LIR=z CMORPH=z RAW_CMORPH=z Wrote to )openwriterrrrcloser*)rr+debugfrrrr r?hs$          zEpochInputState.writecC|t|jvSr)r0rr2rrr hasGfs{zEpochInputState.hasGfscCrCr)r0rr2rrr hasLir}rEzEpochInputState.hasLircCrCr)r0rr6rrr hasCmorphrEzEpochInputState.hasCmorphcCrCr)r0rr6rrr hasRawCmorphrEzEpochInputState.hasRawCmorphc Cs,g}|jD]}tj|dd}||kr||q|r!td|q||_g}|jD]}tj|dd}||kr?||q*|rFtd|q*||_g}|jD]}tj|dd}||krd||qO|rktd|qO||_g} |jD]}tj|dd}||kr| |qt|rtd|qt| |_dS)N00z %Y%m%d%H%M%Sz'Aging off cmorph from input state file z+Aging off raw cmorph from input state file 0000z$Aging off LIR from input state file z$Aging off GFS from input state file )rdatetimestrptimer1r*rrr) rtminrAZcmorphr7tZ raw_cmorphZlirr3gfsrrr removeTooOldsH             zEpochInputState.removeTooOldN)F)__name__ __module__ __qualname__rr.r4r8r9r:r?rDrFrGrHrPrrrr rs-  r)r$r!rKr rrrrrr s