Jump to content

API:EPrints/DataObj/EventQueue: Difference between revisions

From EPrints Documentation
Created page with '<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' com…'
 
Pod2wiki (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- Pod2Wiki=_preamble_  
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/DataObj/EventQueue.pm|package_name=EPrints::DataObj::EventQueue}}[[Category:API|EVENTQUEUE]][[Category:API:EPrints/DataObj|EVENTQUEUE]][[Category:API:EPrints/DataObj/EventQueue|EVENTQUEUE]]<div><!-- Edit below this comment -->
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/EventQueue.pm|package_name=EPrints::DataObj::EventQueue}}[[Category:API|EVENTQUEUE]][[Category:API:EPrints/DataObj|EVENTQUEUE]]<div><!-- Edit below this comment -->




<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
==NAME==
==NAME==
EPrints::DataObj::EventQueue - scheduler/indexer event queue
'''EPrints::DataObj::EventQueue''' - Scheduler/indexer event queue.


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_fields -->
</div>
==FIELDS==
<!-- Pod2Wiki=head_description -->
* eventqueueid
==DESCRIPTION==
: Either a UUID or a hash of the event (if created with [[API:EPrints/DataObj/EventQueue#create_unique|create_unique]]).
Individual tasks for the EPrints event queue that can then be actioned by the EPrints indexer in the background.


* cleanup
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: If set to true removes this event once it has finished. Defaults to true.
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_core_metadata_fields -->
==CORE METADATA FIELDS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_eventqueueid -->
===eventqueueid (uuid)===


* priority
Either a UUID or a hash of the event (if created with  [[API:EPrints/DataObj/EventQueue#create_unique|create_unique]]).
: The priority for this event.


* start_time
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: The event should not be executed before this time.
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->


* end_time
: The event was last touched at this time.


* status
<!-- Pod2Wiki= -->
: The status of this event.
</div>
<!-- Pod2Wiki=item_cleanup -->
===cleanup (boolean)===


* userid
If set to <tt>true</tt> removes this event once it has finished. Defaults to  <tt>true</tt>.
: The user (if any) that was responsible for creating this event.


* description
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: A human-readable description of this event (or error).
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->


* pluginid
: The [[API:EPrints/Plugin/Event|EPrints::Plugin::Event]] plugin id to call to execute this event.


* action
<!-- Pod2Wiki= -->
: The name of the action to execute on the plugin (i.e. method name).
</div>
<!-- Pod2Wiki=item_priority -->
===priority (int)===


* params
The priority for this event.
: Parameters to pass to the action (a text serialisation).


<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_start_time -->
===start_time (time)===
The event should not be executed before this time.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_end_time -->
===end_time (time)===
The event was last touched at this time.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_status -->
===status (set)===
The status of this event. Can be <tt>waiting</tt>, <tt>inprogress</tt>, <tt>success</tt> or <tt>failed</tt>. Defaults to <tt>failed</tt>.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_description -->
===description (longtext)===
A human-readable description of this event (or error).
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_pluginid -->
===pluginid (id)===
The [[API:EPrints/Plugin/Event|EPrints::Plugin::Event]] plugin id to call to execute this event.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_action -->
===action (id)===
The name of the action to execute on the plugin (i.e. method name).
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_params -->
===params (storable)===
Parameters to pass to the action (a text serialisation).
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_references_and_related_objects -->
==REFERENCES AND RELATED OBJECTS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_userid -->
===userid (itemref)===
The user (if any) that was responsible for creating this event.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_instance_variables -->
==INSTANCE VARIABLES==
See [[API:EPrints/DataObj#INSTANCE_VARIABLES|EPrints::DataObj]].
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_methods -->
<!-- Pod2Wiki=head_methods -->
==METHODS==
==METHODS==
<!-- Pod2Wiki=head_create_unique -->
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
===create_unique===
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_constructor_methods -->
===Constructor Methods===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_create_unique -->
====create_unique====
 
$event = EPrints::DataObj::EventQueue-&gt;create_unique( $session, $data, [ $dataset ] )
Returns a unique event queue task using the <tt>$data</tt> provided. Setting the <tt>eventqueueid</tt> to a MD5 hash of the <tt>pluginid</tt>, <tt>action</tt> and (if given) <tt>params</tt>.
 
Returns <tt>undef</tt> if such an event already exists.
 
If <tt>$dataset</tt> is not provided generate from dataset ID of the class.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->


<source lang="perl">$event = EPrints::DataObj::EventQueue->create_unique( $repo, $data [, $dataset ] )


</source>
<!-- Pod2Wiki= -->
Creates a unique event by setting the <code>eventqueueid</code> to a hash of the <code>pluginid</code>, <code>action</code> and (if given) <code>params</code>.
</div>
<!-- Pod2Wiki=item_new_from_hash -->
====new_from_hash====


Returns undef if such an event already exists.
$event = EPrints::DataObj::EventQueue-&gt;new_from_hash( $session, $data, [ $dataset ] )
Returns the event that corresponds to the MD5 hash of the <tt>$data</tt> provided, (<tt>pluginid</tt>, <tt>action</tt> and <tt>params</tt>).  Returns <tt>undef</tt> if no event queue task exists with a matching MD5 hash.


If <tt>$dataset</tt> is not provided generate from dataset ID of the class.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_execute -->
</div>
===execute===
<!-- Pod2Wiki=head_class_methods -->
===Class Methods===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_get_system_field_info -->
====get_system_field_info====
 
$metadata = EPrints::DataObj::EPrint-&gt;get_system_field_info
Returns an array describing the system metadata of the event queue  dataset.
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
 


<source lang="perl">$ok = $event->execute()
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=item_get_dataset_id -->
====get_dataset_id====


</source>
$dataset = EPrints::DataObj::EPrint-&gt;get_dataset_id
Execute the action this event describes.
Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.


The return from the [[API:EPrints/Plugin/Event|EPrints::Plugin::Event]] plugin action is treated as:
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->


<pre>  undef - equivalent to HTTP_OK
  HTTP_OK - action succeeded, event is removed if cleanup is TRUE
  HTTP_RESET_CONTENT - action succeeded, event is set 'waiting'
  HTTP_NOT_FOUND - action failed, event is removed if cleanup is TRUE
  HTTP_LOCKED - action failed, event is re-scheduled for 10 minutes time
  HTTP_INTERNAL_SERVER_ERROR - action failed, event is 'failed' and kept</pre>


<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_object_methods -->
===Object Methods===
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_message -->
</div>
===message===
<!-- Pod2Wiki=item_execute -->
====execute====


<source lang="perl">$event->message( $type, $xhtml )
$ok = $event-&gt;execute()
Execute the action this event queue task describes.


</source>
The response from the [[API:EPrints/Plugin/Event|EPrints::Plugin::Event]] plugin action is  treated as follows:
Utility method to log a message for this event.


undef - equivalent to HTTP_OK
HTTP_OK - action succeeded, event is removed if cleanup is TRUE
HTTP_RESET_CONTENT - action succeeded, event is set 'waiting'
HTTP_NOT_FOUND - action failed, event is removed if cleanup is TRUE
HTTP_LOCKED - action failed, event is re-scheduled for 10 minutes time
HTTP_INTERNAL_SERVER_ERROR - action failed, event is 'failed' and kept
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_copyright -->
</div>
==COPYRIGHT==
<!-- Pod2Wiki=item_message -->
: Copyright 2000-2011 University of Southampton.
====message====


: This file is part of EPrints http://www.eprints.org/.
$event-&gt;message( $type, $message )
Utility method to log the <tt>$message</tt> for this event.


: EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
<tt>$type</tt> is required by this method but not currently used.


: EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->


: You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.


<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=head_see_also -->
==SEE ALSO==
[[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|EPrints::DataSet]].
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->




<!-- Pod2Wiki= -->
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=_postamble_ -->
</div>
<!-- Pod2Wiki=head_copyright -->
==COPYRIGHT==
{{API:Copyright}}
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<span style='display:none'>User Comments</span>
<!-- Edit below this comment -->
<!-- Edit below this comment -->
<!-- Pod2Wiki= -->
</div>
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Latest revision as of 16:51, 10 January 2022

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME[edit]

EPrints::DataObj::EventQueue - Scheduler/indexer event queue.

User Comments


DESCRIPTION[edit]

Individual tasks for the EPrints event queue that can then be actioned by the EPrints indexer in the background.

User Comments


CORE METADATA FIELDS[edit]

User Comments


eventqueueid (uuid)[edit]

Either a UUID or a hash of the event (if created with create_unique).

User Comments


cleanup (boolean)[edit]

If set to true removes this event once it has finished. Defaults to true.

User Comments


priority (int)[edit]

The priority for this event.

User Comments


start_time (time)[edit]

The event should not be executed before this time.

User Comments


end_time (time)[edit]

The event was last touched at this time.

User Comments


status (set)[edit]

The status of this event. Can be waiting, inprogress, success or failed. Defaults to failed.

User Comments


description (longtext)[edit]

A human-readable description of this event (or error).

User Comments


pluginid (id)[edit]

The EPrints::Plugin::Event plugin id to call to execute this event.

User Comments


action (id)[edit]

The name of the action to execute on the plugin (i.e. method name).

User Comments


params (storable)[edit]

Parameters to pass to the action (a text serialisation).

User Comments


REFERENCES AND RELATED OBJECTS[edit]

User Comments


userid (itemref)[edit]

The user (if any) that was responsible for creating this event.

User Comments


INSTANCE VARIABLES[edit]

See EPrints::DataObj.

User Comments


METHODS[edit]

User Comments


Constructor Methods[edit]

User Comments


create_unique[edit]

$event = EPrints::DataObj::EventQueue->create_unique( $session, $data, [ $dataset ] )

Returns a unique event queue task using the $data provided. Setting the eventqueueid to a MD5 hash of the pluginid, action and (if given) params.

Returns undef if such an event already exists.

If $dataset is not provided generate from dataset ID of the class.

User Comments


new_from_hash[edit]

$event = EPrints::DataObj::EventQueue->new_from_hash( $session, $data, [ $dataset ] )

Returns the event that corresponds to the MD5 hash of the $data provided, (pluginid, action and params). Returns undef if no event queue task exists with a matching MD5 hash.

If $dataset is not provided generate from dataset ID of the class.

User Comments


Class Methods[edit]

User Comments


get_system_field_info[edit]

$metadata = EPrints::DataObj::EPrint->get_system_field_info

Returns an array describing the system metadata of the event queue dataset.

User Comments


get_dataset_id[edit]

$dataset = EPrints::DataObj::EPrint->get_dataset_id

Returns the ID of the EPrints::DataSet object to which this record belongs.

User Comments


Object Methods[edit]

User Comments


execute[edit]

$ok = $event->execute()

Execute the action this event queue task describes.

The response from the EPrints::Plugin::Event plugin action is treated as follows:

undef - equivalent to HTTP_OK
HTTP_OK - action succeeded, event is removed if cleanup is TRUE
HTTP_RESET_CONTENT - action succeeded, event is set 'waiting'
HTTP_NOT_FOUND - action failed, event is removed if cleanup is TRUE
HTTP_LOCKED - action failed, event is re-scheduled for 10 minutes time
HTTP_INTERNAL_SERVER_ERROR - action failed, event is 'failed' and kept
 

User Comments


message[edit]

$event->message( $type, $message )

Utility method to log the $message for this event.

$type is required by this method but not currently used.

User Comments


SEE ALSO[edit]

EPrints::DataObj and EPrints::DataSet.

User Comments


COPYRIGHT[edit]

© Copyright 2000-2024 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE[edit]

This file is part of EPrints 3.4 http://www.eprints.org/.

EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.

EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.

User Comments