Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
protogrid:agents [2021-06-06 22:26] 185.110.184.205protogrid:agents [2021-06-06 22:40] – [Execution] 185.110.184.205
Line 62: Line 62:
 ===== Execution ====== ===== Execution ======
 Agents are by default checked every hour (this can be modified for your environment, please contact the Protogrid Operations Team). If any DateTime Field on a card has a smaller value than the current time and the Agent has not yet run since that time, the Agent gets triggered and the code in the Agent Library is executed in the context of this card (for Date-Only Fields, the time taken into account is said date, 00:00 GMT). Agents run in the context of a specific user profile. This user's password is automatically reset during the execution process. So this user profile shall only be used for agents and not for physical users. All agent executions are logged in the //agent_log// on the respective card. Agents are by default checked every hour (this can be modified for your environment, please contact the Protogrid Operations Team). If any DateTime Field on a card has a smaller value than the current time and the Agent has not yet run since that time, the Agent gets triggered and the code in the Agent Library is executed in the context of this card (for Date-Only Fields, the time taken into account is said date, 00:00 GMT). Agents run in the context of a specific user profile. This user's password is automatically reset during the execution process. So this user profile shall only be used for agents and not for physical users. All agent executions are logged in the //agent_log// on the respective card.
 +
 +While an agent is running in the context of a specific card, it is also possible to load and save other cards by calling the JSON API endpoints using axios. A valid axios module is given in the //on_schedule// function. Agents have a global runtime limit (usually one hour). If you want to restrict this limit for certain agents, you can do so by entering the desired maximum runtime (in milliseconds) in the Agent card. After reaching the runtime limit, the code will terminate instantly and the next card will be processed. The process will not be started if the time until the next agent check is less than the maximum runtime.
 +
 +The //on_schedule// function should return a boolean. If the boolean is true, the card that triggered the agent will be saved.
  
 ===== Best Practices for Calculation Code ====== ===== Best Practices for Calculation Code ======
Print/export