archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
38 stars 37 forks source link

Is there a way to speed up the initial monitoring period? #184

Closed jembishop closed 5 months ago

jembishop commented 8 months ago

Hi I am using the EPICS archiver appliance as part of a end to end testing setup. Is there a way to speed up the intial monitoring period? I just have a few test PVS I want to insert and I would prefer if they were tracked instantly, so I can run my integration tests fast.

jacomago commented 8 months ago

Can you give any more details about what you mean by "intial monitoring period"?

There is

If you are only using the Archiver for integration tests and don't need persistence after the test has completed. You might want to use the command:

gradle testRun

on the master branch after commit 5953ad98549798e9dea7fea01fb585b08eef41c2 . The command starts up the archiver with the same configuration as for development testing, which has a lot of settings shorter than production.

Another option is to make a really minimal policy.py file, that sets up all the details immediatly. i.e. samplingPeriod, samplingMethod and appliance.

jembishop commented 8 months ago

Thanks for getting back to me. I was refering to the around 5 minute delay between clicking the archive button, and the PV actually being started archived. It looks like the policy.py file would probably be the best way to go here, I will try that. Thanks again

jembishop commented 8 months ago

Would you mind helping me out with my policies.py file? This is what I think I need, its not working however it gives me An error occured on the server while requesting these PVs to be archived -- error -- on the frontend and I can't see anything in the logs. Is the "skipCapacityPlanning" key the one I need?

def getPolicyList():
    pvPoliciesDict = {}
    pvPoliciesDict['Default'] = 'The default policy'
    return pvPoliciesDict

# Define a list of fields that will be archived as part of every PV.
# The data for these fields will included in the stream for the PV.
# We also make an assumption that the data type for these fields is the same as that of the .VAL field

# We use the environment variables ARCHAPPL_SHORT_TERM_FOLDER and ARCHAPPL_MEDIUM_TERM_FOLDER to determine the location of the STS and the MTS in the appliance
shorttermstore_plugin_url = 'pb://localhost?name=STS&rootFolder=${ARCHAPPL_SHORT_TERM_FOLDER}&partitionGranularity=PARTITION_HOUR&consolidateOnShutdown=true'
mediumtermstore_plugin_url = 'pb://localhost?name=MTS&rootFolder=${ARCHAPPL_MEDIUM_TERM_FOLDER}&partitionGranularity=PARTITION_DAY&hold=2&gather=1'
longtermstore_plugin_url = 'pb://localhost?name=LTS&rootFolder=${ARCHAPPL_LONG_TERM_FOLDER}&partitionGranularity=PARTITION_YEAR'
#longtermstore_plugin_url = 'blackhole://localhost'

def determinePolicy(pvInfoDict):
    pvPolicyDict = {}
    pvPolicyDict['samplingPeriod'] = 1.0
    pvPolicyDict['samplingMethod'] = 'MONITOR'
    pvPolicyDict['skipCapacityPlanning'] = True
    pvPolicyDict['dataStores'] = [
        shorttermstore_plugin_url, 
        mediumtermstore_plugin_url, 
        longtermstore_plugin_url
        ]
    pvPolicyDict['policyName'] = 'Default'
    pvPolicyDict["archiveFields"]=[]

    return pvPolicyDict
jacomago commented 8 months ago

I think you're right that if you set skipCapacityPlanning in the archive request, it should skip the policy file entirely.

Maybe you need to define the function

def getFieldsArchivedAsPartOfStream(): return []

There is a separate log file for errors from the policies.py file. Something like /var/log/tomcat/arch-policy.log that might give you useful error output.

I would also set the "appliance" field, as it should reduce some of the logic needed before archiving.