<!-- 
RSS generated by JIRA (1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d) at Thu Feb 08 23:09:04 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>FOLIO Jira</title>
    <link>https://folio-org.atlassian.net</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>1001.0.0-SNAPSHOT</version>
        <build-number>100246</build-number>
        <build-date>07-02-2024</build-date>
    </build-info>

<item>
            <title>[FOLIO-889] Develop a strategy to implement scheduled (cron-like) events</title>
                <link>https://folio-org.atlassian.net/browse/FOLIO-889</link>
                <project id="10290" key="FOLIO">FOLIO</project>
                    <description>&lt;p&gt;We need a way to have certain events happen at regular and scheduled intervals. Examples include:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Scheduling batch processing&lt;/li&gt;
	&lt;li&gt;Checking for expired records and pruning appropriately&lt;/li&gt;
	&lt;li&gt;Clean up processes&lt;/li&gt;
	&lt;li&gt;Periodic audits&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Any solution will need to answer the following questions:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;How is security/ownership assigned to a task?&lt;/li&gt;
	&lt;li&gt;How exactly is the task specified? Do we require a DSL to specify task actions?&lt;/li&gt;
	&lt;li&gt;How does this tie-in with projected implementation of workflows (if at all)?&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="80519">FOLIO-889</key>
            <summary>Develop a strategy to implement scheduled (cron-like) events</summary>
                <type id="10005" iconUrl="https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10309?size=medium">Story</type>
                                            <priority id="10002" iconUrl="https://dev.folio.org/assets/jira-priority/jira-p3.svg">P3</priority>
                        <status id="6" iconUrl="https://folio-org.atlassian.net/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10003">Done</resolution>
                                                        <assignee accountid="5c38e8d616ac1e4f7cbc660a">Kurt Nordstrom</assignee>
                                                                <reporter accountid="5c38e8d616ac1e4f7cbc660a">Kurt Nordstrom</reporter>
                                    <labels>
                            <label>core</label>
                            <label>sprint24</label>
                            <label>sprint25</label>
                    </labels>
                <created>Mon, 9 Oct 2017 16:23:03 +0000</created>
                <updated>Thu, 2 May 2019 11:27:30 +0000</updated>
                            <resolved>Thu, 24 May 2018 09:11:25 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>7</watches>
                                                                <comments>
                                                            <comment id="190489" author="5af5ed55244bc90a106063c7" created="Tue, 10 Oct 2017 09:29:05 +0000"  >&lt;p&gt;Sending overdue notices is another feature that may benefit from this.  Calculating accumulated overdue fines also maybe...&lt;/p&gt;

&lt;p&gt;Should we label this as sprint24?&lt;/p&gt;</comment>
                                                            <comment id="190491" author="5c38e8d616ac1e4f7cbc660a" created="Wed, 18 Oct 2017 21:04:53 +0000"  >&lt;p&gt;There are many &quot;events&quot; within FOLIO that need to happen at regularly scheduled intervals. Examples of events such as these would be checking for overdue loans, compounding fines, cleaning up unneeded data and the like. &lt;/p&gt;

&lt;p&gt;The actions of a FOLIO cron job are relatively simple. A script will be designated to run at a particular interval. When it runs, it will make a number of calls to one or more other modules within FOLIO and make internal decisions based on the responses it gets.&lt;/p&gt;

&lt;p&gt;A reasonable &quot;mod-cron&quot; module needs to deal with the following considerations:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Any mod-cron job will need to be associated with an authtoken of some kind. There needs to be a way to track who &quot;owns&quot; a given job, and what set of permissions it runs with. Ideally, no job should run with more permissions than it actually needs to accomplish what it needs to do.&lt;/li&gt;
	&lt;li&gt;There needs to be a way to allow mod-cron job designers to assign reasonably complex logic to a job.&lt;/li&gt;
	&lt;li&gt;There should ideally be a way to pause and resume jobs.&lt;/li&gt;
	&lt;li&gt;There needs to be tracking of which jobs have run and when.&lt;/li&gt;
	&lt;li&gt;Ideally, there should be a central log file to be able to check the output of past jobs.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It is worth noting that it would be possible to obtain a cron-like functionality by building external scripts that authenticate into FOLIO and execute commands as needed. Such a script could be scheduled with something like Unix cron and potentially live anywhere that could talk to the FOLIO modules.&lt;/p&gt;

&lt;p&gt;There are a few problems with the &quot;external cron jobs&quot;, though:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;No way to centrally manage scheduling/starting/stopping of jobs.&lt;/li&gt;
	&lt;li&gt;No way to modify a job from within FOLIO.&lt;/li&gt;
	&lt;li&gt;No central record of executions or job outputs.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I envision a mod-cron module to operate around the following data model:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
{
	&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; : &quot;&quot;,
	&lt;span class=&quot;code-quote&quot;&gt;&quot;ownerId&quot;&lt;/span&gt; : &quot;&quot;,
	&lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt; : &quot;&quot;,
	&lt;span class=&quot;code-quote&quot;&gt;&quot;description&quot;&lt;/span&gt; : &quot;&quot;,
	&lt;span class=&quot;code-quote&quot;&gt;&quot;active&quot;&lt;/span&gt; : &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
	&lt;span class=&quot;code-quote&quot;&gt;&quot;schedule&quot;&lt;/span&gt; : {
		&lt;span class=&quot;code-quote&quot;&gt;&quot;dayOfWeek&quot;&lt;/span&gt; : &quot;&quot;,
		&lt;span class=&quot;code-quote&quot;&gt;&quot;month&quot;&lt;/span&gt; : &quot;&quot;,
		&lt;span class=&quot;code-quote&quot;&gt;&quot;dayOfMonth&quot;&lt;/span&gt; : &quot;&quot;,
		&lt;span class=&quot;code-quote&quot;&gt;&quot;hour&quot;&lt;/span&gt; : &quot;&quot;,
		&lt;span class=&quot;code-quote&quot;&gt;&quot;minute&quot;&lt;/span&gt;
	},
	&lt;span class=&quot;code-quote&quot;&gt;&quot;cronscript&quot;&lt;/span&gt; : &quot;&quot;
	
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The fields are defined as follows:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;id : This is the unique UUID that identifies the particular job.&lt;/li&gt;
	&lt;li&gt;ownerId: The owner of the job, for which the job will take its permissions.&lt;/li&gt;
	&lt;li&gt;name: A human-readable short name for the job (e.g. &quot;update fines&quot;).&lt;/li&gt;
	&lt;li&gt;description: A longer, human-readable explanation for the job.&lt;/li&gt;
	&lt;li&gt;active: A boolean which indicates whether or not a given job is currently running.&lt;/li&gt;
	&lt;li&gt;schedule: A structure which determines when the job should actually run.&lt;/li&gt;
	&lt;li&gt;cronscript: A textual blob containing the actual script that gets executed. The allowable scripting is a topic of importance.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                                                            <comment id="190494" author="712020:38d1a08f-86a8-4df2-9191-239b16b0a81a" created="Tue, 24 Oct 2017 13:32:00 +0000"  >&lt;p&gt;I seem to recall that we had some kind of harvester project at ID long time ago, with a similar kind of cron-like specification. I don&apos;t think we were really happy with that. Most users needed to specify that something should happen daily or weekly, but not at what time of the night things should happen, etc.&lt;/p&gt;

&lt;p&gt;Also, if we ever make that workflow/automation thing, it seems like the ideal way to control what should be happening.&lt;/p&gt;</comment>
                                                            <comment id="190497" author="5c38e8d616ac1e4f7cbc660a" created="Tue, 24 Oct 2017 15:35:17 +0000"  >&lt;p&gt;My initial thoughts on the &quot;cronscript&quot; field was that this would be a blob that would contain the text of a script that would actually execute as per the schedule and carry out the instructions of the task. Something like Groovy would work as a sandboxed DSM, for which we&apos;d provide execution constraints, as well as a limited number of FOLIO-affecting calls that the script could actually make.&lt;/p&gt;

&lt;p&gt;I think this offers some powerful advantages, namely that expressive and useful automations can be created and managed in userspace. It gives a lot of flexibility and utility to individual systems.&lt;/p&gt;

&lt;p&gt;There are downsides to this approach, though:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Potential risks to permitting arbitrary scripting, in spite of sandboxing&lt;/li&gt;
	&lt;li&gt;Need to maintain scripts when system updates&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;An alternative approach might be to define the useful behaviors in the modules themselves. For example, mod-users-bl might have a method to send overdue notices defined, since this is a logical place that is very close to the involved modules. What we&apos;d need to do then would be a way to expose these &quot;tasks&quot; to the API, and mod-cron&apos;s job would be to call these task endpoints in accordance with the defined schedules.&lt;/p&gt;</comment>
                                                            <comment id="190499" author="5af5ed55244bc90a106063c7" created="Thu, 17 May 2018 16:44:05 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5c38e8d616ac1e4f7cbc660a&quot; class=&quot;user-hover&quot; rel=&quot;5c38e8d616ac1e4f7cbc660a&quot; data-account-id=&quot;5c38e8d616ac1e4f7cbc660a&quot; accountid=&quot;5c38e8d616ac1e4f7cbc660a&quot; rel=&quot;noreferrer&quot;&gt;Kurt Nordstrom&lt;/a&gt; and &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; class=&quot;user-hover&quot; rel=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; data-account-id=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; accountid=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; rel=&quot;noreferrer&quot;&gt;Jakub Skoczen&lt;/a&gt; is this ticket still needed?  If so, let&apos;s finish it up.  If not, let&apos;s close it.&lt;/p&gt;</comment>
                                                            <comment id="190500" author="5c38e8d616ac1e4f7cbc660a" created="Wed, 23 May 2018 15:21:43 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5af5ed55244bc90a106063c7&quot; class=&quot;user-hover&quot; rel=&quot;5af5ed55244bc90a106063c7&quot; data-account-id=&quot;5af5ed55244bc90a106063c7&quot; accountid=&quot;5af5ed55244bc90a106063c7&quot; rel=&quot;noreferrer&quot;&gt;Cate Boerema&lt;/a&gt; I would feel that this would be subsumed by the workflow work being done. I have no objection to closing it.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="81188">FOLIO-1953</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="44528">UIU-200</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="44530">UIU-201</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="44577">UIU-235</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummarycf">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10019" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|hzy0wv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10020" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10024" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>[CHART] Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 10 Oct 2017 09:29:05 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10025" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>[CHART] Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>