blob: a26acde7d168d19878d82c79d532352ffce816c0 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8" />
<title>SMILA/Documentation/Worker/ScriptProcessorWorker - Eclipsepedia</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="generator" content="MediaWiki 1.23.2" />
<link rel="shortcut icon" href="http://wiki.eclipse.org/eclipse.org-common/themes/solstice/public/images/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="http://wiki.eclipse.org/opensearch_desc.php" title="Eclipsepedia (en)" />
<link rel="EditURI" type="application/rsd+xml" href="http://wiki.eclipse.org/api.php?action=rsd" />
<link rel="alternate" type="application/atom+xml" title="Eclipsepedia Atom feed" href="http://wiki.eclipse.org/index.php?title=Special:RecentChanges&amp;feed=atom" />
<link rel="stylesheet" href="http://wiki.eclipse.org/load.php?debug=false&amp;lang=en&amp;modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.ui.button&amp;only=styles&amp;skin=solstice&amp;*" />
<link rel="stylesheet" href="http://wiki.eclipse.org/skins/solstice/public/stylesheets/styles.min.css?303" media="screen, print" /><meta name="ResourceLoaderDynamicStyles" content="" />
<style>a:lang(ar),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}
/* cache key: my_wiki:resourceloader:filter:minify-css:7:14ece53a42aa314864e5fd8c57f0d98f */</style>
<script src="http://wiki.eclipse.org/load.php?debug=false&amp;lang=en&amp;modules=startup&amp;only=scripts&amp;skin=solstice&amp;*"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"SMILA/Documentation/Worker/ScriptProcessorWorker","wgTitle":"SMILA/Documentation/Worker/ScriptProcessorWorker","wgCurRevisionId":373973,"wgRevisionId":373973,"wgArticleId":45968,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"SMILA/Documentation/Worker/ScriptProcessorWorker","wgIsProbablyEditable":false,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgWikiEditorEnabledModules":{"toolbar":false,"dialogs":false,"hidesig":true,"preview":false,"previewDialog":false,"publish":false},"wgCategoryTreePageCategoryOptions":"{\"mode\":0,\"hideprefix\":20,\"showcount\":true,\"namespaces\":false}"});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function($,jQuery){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"editfont":"default","editondblclick":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":1,"extendwatchlist":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nickname":"","norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"rcdays":7,"rclimit":50,"rows":25,"showhiddencats":0,"shownumberswatching":1,"showtoolbar":1,"skin":"solstice","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":1,"watchdefault":1,"watchdeletion":0,"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,
"useeditwarning":1,"prefershttps":1,"language":"en","variant-gan":"gan","variant-iu":"iu","variant-kk":"kk","variant-ku":"ku","variant-shi":"shi","variant-sr":"sr","variant-tg":"tg","variant-uz":"uz","variant-zh":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"variant":"en"});},{},{});mw.loader.implement("user.tokens",function($,jQuery){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});},{},{});
/* cache key: my_wiki:resourceloader:filter:minify-js:7:70d74423d3fc1e1c18fa9a1ff645a84a */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-SMILA_Documentation_Worker_ScriptProcessorWorker skin-solstice action-view" id="solstice">
<a class="sr-only" href="ScriptProcessorWorker.html#content">Skip to main content</a>
<div class="thin-header">
<header role="banner" class="hidden-print noprint">
<div class="container-fluid">
<div id="row-logo-search">
<div id="header-left">
<div class="row">
<div class="hidden-xs col-sm-6 logo-container">
<a href="https://www.eclipse.org/" ><img class="logo-eclipse-default" src="http://wiki.eclipse.org/skins/solstice/public/images/logo/eclipse-800x188.png" alt="Eclipsepedia"></a>
</div>
<div class="navbar col-sm-18 yamm" id="main-menu">
<div class="navbar-collapse collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a target="_self" href="https://eclipse.org/downloads/">Download</a></li>
<li><a target="_self" href="https://eclipse.org/users/">Getting Started </a></li>
<li><a target="_self" href="https://eclipse.org/membership/">Members</a></li>
<li><a target="_self" href="https://eclipse.org/projects/">Projects</a></li>
<li class="dropdown visible-xs"><a class="dropdown-toggle" data-toggle="dropdown" href="ScriptProcessorWorker.html#">Community <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="http://marketplace.eclipse.org">Marketplace</a></li><li><a href="http://events.eclipse.org">Events</a></li><li><a href="http://www.planeteclipse.org/">Planet Eclipse</a></li><li><a href="https://eclipse.org/community/eclipse_newsletter/">Newsletter</a></li><li><a href="https://www.youtube.com/user/EclipseFdn">Videos</a></li></ul></li><li class="dropdown visible-xs"><a class="dropdown-toggle" data-toggle="dropdown" href="ScriptProcessorWorker.html#">Participate <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="https://bugs.eclipse.org/bugs/">Report a Bug</a></li><li><a href="https://eclipse.org/forums/">Forums</a></li><li><a href="https://eclipse.org/mail/">Mailing Lists</a></li><li><a href="https://wiki.eclipse.org/">Wiki</a></li><li><a href="https://wiki.eclipse.org/IRC">IRC</a></li><li><a href="https://eclipse.org/contribute/">How to Contribute</a></li></ul></li><li class="dropdown visible-xs"><a class="dropdown-toggle" data-toggle="dropdown" href="ScriptProcessorWorker.html#">Working Groups <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="http://wiki.eclipse.org/Auto_IWG">Automotive</a></li><li><a href="http://iot.eclipse.org">Internet of Things</a></li><li><a href="http://locationtech.org">LocationTech</a></li><li><a href="http://lts.eclipse.org">Long-Term Support</a></li><li><a href="http://polarsys.org">PolarSys</a></li><li><a href="http://science.eclipse.org">Science</a></li><li><a href="http://openmdm.org">OpenMDM</a></li></ul></li><!-- More -->
<li class="dropdown hidden-xs"><a class="dropdown-toggle" data-toggle="dropdown">More<b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<!-- Content container to add padding -->
<div class="yamm-content">
<div class="row">
<ul class="col-sm-8 list-unstyled"><li><p><strong>Community</strong></p></li><li><a href="http://marketplace.eclipse.org">Marketplace</a></li><li><a href="http://events.eclipse.org">Events</a></li><li><a href="http://www.planeteclipse.org/">Planet Eclipse</a></li><li><a href="https://eclipse.org/community/eclipse_newsletter/">Newsletter</a></li><li><a href="https://www.youtube.com/user/EclipseFdn">Videos</a></li></ul><ul class="col-sm-8 list-unstyled"><li><p><strong>Participate</strong></p></li><li><a href="https://bugs.eclipse.org/bugs/">Report a Bug</a></li><li><a href="https://eclipse.org/forums/">Forums</a></li><li><a href="https://eclipse.org/mail/">Mailing Lists</a></li><li><a href="https://wiki.eclipse.org/">Wiki</a></li><li><a href="https://wiki.eclipse.org/IRC">IRC</a></li><li><a href="https://eclipse.org/contribute/">How to Contribute</a></li></ul><ul class="col-sm-8 list-unstyled"><li><p><strong>Working Groups</strong></p></li><li><a href="http://wiki.eclipse.org/Auto_IWG">Automotive</a></li><li><a href="http://iot.eclipse.org">Internet of Things</a></li><li><a href="http://locationtech.org">LocationTech</a></li><li><a href="http://lts.eclipse.org">Long-Term Support</a></li><li><a href="http://polarsys.org">PolarSys</a></li><li><a href="http://science.eclipse.org">Science</a></li><li><a href="http://openmdm.org">OpenMDM</a></li></ul> </div>
</div>
</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-header">
<button data-target="#navbar-collapse-1" data-toggle="collapse" class="navbar-toggle" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="https://www.eclipse.org/" class="visible-xs navbar-brand"><img class="logo-eclipse-default" src="http://wiki.eclipse.org/skins/solstice/public/images/logo/eclipse-800x188.png" alt="Eclipsepedia" width="174"></a>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<section class="defaut-breadcrumbs hidden-print noprint hidden-print clearfix" id="breadcrumb">
<div>
<ol class="breadcrumb">
<li><a href="https://www.eclipse.org/">Home</a></li>
<li><a href="http://wiki.eclipse.org/Main_Page">Eclipse Wiki</a></li>
<li class="active">SMILA/Documentation/Worker/ScriptProcessorWorker</li></ol>
</div>
</section>
</div>
<div class="toolbar-menu breadcrumbs-offset noprint hidden-print margin-bottom-0 clearfix">
<div class="col-md-24">
<ol class="breadcrumb" role="navigation">
<li id="pt-login">
<a href="http://wiki.eclipse.org/index.php?title=Special:UserLogin&amp;returnto=SMILA%2FDocumentation%2FWorker%2FScriptProcessorWorker">
<i class="fa fa-sign-in fa-fw orange"></i> Log in </a>
</li>
</ul>
</div>
</div>
<main role="main" class="background-grey">
<div class="container-full padding-top-25">
<!-- content -->
<section id="content" class="mw-body container-full clearfix 0">
<div id="mw-js-message" style="display:none;"></div>
<!-- bodyContent -->
<div id="bodyContent">
<!-- jumpto -->
<div id="jump-to-nav" class="mw-jump">
Jump to: <a href="ScriptProcessorWorker.html#mw-head">navigation</a>,
<a href="ScriptProcessorWorker.html#p-search">search</a>
</div>
<!-- /jumpto -->
<!-- leftcol -->
<aside class="col-md-4 noprint hidden-print" id="leftcol">
<form class="input-group" role="form" id="form-eclipse-search" action="http://wiki.eclipse.org/index.php" id="searchform">
<input id="searchInput" class="search-query form-control" type="search" accesskey="f" title="Special:Search" placeholder="Search" name="search" value="">
<span class="input-group-btn">
<button value="search" id="mw-searchButton" type="submit" class="btn btn-default" title="Search the pages for this text" name="fulltext">
<i class="fa fa-search"></i>
</button>
</span>
</form>
<select class="form-control margin-top-10 margin-bottom-10 visible-xs visible-sm" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);"><option class="fw-700 "><span class="fw-700">---Navigation---</span></option><option value="/Main_Page">Main Page</option><option value="/Eclipsepedia:Community_portal">Community portal</option><option value="/Eclipsepedia:Current_events">Current events</option><option value="/Special:RecentChanges">Recent changes</option><option value="/Special:Random">Random page</option><option value="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">Help</option></select><ul class="ul-left-nav fa-ul hidden-print leftnav hidden-xs hidden-sm"><li class="separator"><span class="separator">Navigation</span></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Main_Page" id="n-mainpage" title="Visit the main page [z]" accesskey="z">Main Page</a></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Eclipsepedia:Community_portal" id="n-portal" title="About the project, what you can do, where to find things">Community portal</a></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Eclipsepedia:Current_events" id="n-currentevents" title="Find background information on current events">Current events</a></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Special:RecentChanges" id="n-recentchanges" title="A list of recent changes in the wiki [r]" accesskey="r">Recent changes</a></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Special:Random" id="n-randompage" title="Load a random page [x]" accesskey="x">Random page</a></li> <li class=""><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents" id="n-help" title="The place to find out">Help</a></li></ul> <select class="form-control margin-top-10 margin-bottom-10 visible-xs visible-sm" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);"><option class="fw-700 "><span class="fw-700">---Toolbox---</span></option><option value="/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;action=info">Page information</option><option value="/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;oldid=373973">Permanent link</option><option value="/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;printable=yes">Printable version</option><option value="/Special:SpecialPages">Special pages</option><option value="/Special:RecentChangesLinked/SMILA/Documentation/Worker/ScriptProcessorWorker">Related changes</option><option value="/Special:WhatLinksHere/SMILA/Documentation/Worker/ScriptProcessorWorker">What links here</option></select><ul class="ul-left-nav fa-ul hidden-print leftnav hidden-xs hidden-sm"><li class="separator"><span class="separator">Toolbox</span></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;action=info" id="t-info">Page information</a></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;oldid=373973" id="t-permalink" title="Permanent link to this revision of the page">Permanent link</a></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;printable=yes" id="t-print" rel="alternate" title="Printable version of this page [p]" accesskey="p">Printable version</a></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Special:SpecialPages" id="t-specialpages" title="A list of all special pages [q]" accesskey="q">Special pages</a></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Special:RecentChangesLinked/SMILA/Documentation/Worker/ScriptProcessorWorker" id="t-recentchangeslinked" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li><li><i class="fa fa-angle-double-right orange fa-fw"></i> <a href="http://wiki.eclipse.org/Special:WhatLinksHere/SMILA/Documentation/Worker/ScriptProcessorWorker" id="t-whatlinkshere" title="A list of all wiki pages that link here [j]" accesskey="j">What links here</a></li></ul> </aside>
<!-- /leftcol -->
<!-- mainContent -->
<div id="mainContent" class="col-md-20">
<ul class="nav nav-tabs noprint hidden-print" role="tablist">
<li id="ca-nstab-main" class="active"><a href="ScriptProcessorWorker.html" title="View the content page [c]" accesskey="c" tabindex="-1">Page</a></li>
<li id="ca-talk" class="new"><a href="http://wiki.eclipse.org/index.php?title=Talk:SMILA/Documentation/Worker/ScriptProcessorWorker&amp;action=edit&amp;redlink=1" title="Discussion about the content page [t]" accesskey="t" tabindex="-1">Discussion</a></li>
<li id="ca-viewsource"><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;action=edit" title="This page is protected.&#10;You can view its source [e]" accesskey="e" tabindex="-1">View source</a></li>
<li id="ca-history" class="collapsible"><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;action=history" title="Past revisions of this page [h]" accesskey="h" tabindex="-1">History</a></li>
</ul> <div class="tab-content background-white">
<div id="tab-pane-main-page-content" class="tab-pane active">
<h1 id="firstHeading" class="firstHeading page-header">
<span dir="auto">SMILA/Documentation/Worker/ScriptProcessorWorker</span>
</h1>
<div id="main-page-content">
<!-- subtitle -->
<div id="contentSub" class="alert alert-small alert-warning"><span class="subpages">&lt; <a href="../../../SMILA.html" title="SMILA">SMILA</a>&lrm; | <a href="../../Documentation.1.html" title="SMILA/Documentation">Documentation</a></span></div>
<!-- /subtitle -->
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="ScriptProcessorWorker.html#ScriptProcessorWorker_.28bundle_org.eclipse.smila.scripting.29"><span class="tocnumber">1</span> <span class="toctext">ScriptProcessorWorker (bundle org.eclipse.smila.scripting)</span></a>
<ul>
<li class="toclevel-2 tocsection-2"><a href="ScriptProcessorWorker.html#Configuration"><span class="tocnumber">1.1</span> <span class="toctext">Configuration</span></a></li>
<li class="toclevel-2 tocsection-3"><a href="ScriptProcessorWorker.html#Worker_Definition"><span class="tocnumber">1.2</span> <span class="toctext">Worker Definition</span></a>
<ul>
<li class="toclevel-3 tocsection-4"><a href="ScriptProcessorWorker.html#Input_.2F_Output"><span class="tocnumber">1.2.1</span> <span class="toctext">Input / Output</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-5"><a href="ScriptProcessorWorker.html#Accessing_Task_Parameters_in_Pipelets"><span class="tocnumber">1.3</span> <span class="toctext">Accessing Task Parameters in Pipelets</span></a></li>
<li class="toclevel-2 tocsection-6"><a href="ScriptProcessorWorker.html#Error_Handling"><span class="tocnumber">1.4</span> <span class="toctext">Error Handling</span></a>
<ul>
<li class="toclevel-3 tocsection-7"><a href="ScriptProcessorWorker.html#Special_Logging"><span class="tocnumber">1.4.1</span> <span class="toctext">Special Logging</span></a></li>
<li class="toclevel-3 tocsection-8"><a href="ScriptProcessorWorker.html#Other_Extras"><span class="tocnumber">1.4.2</span> <span class="toctext">Other Extras</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<h1><span class="mw-headline" id="ScriptProcessorWorker_.28bundle_org.eclipse.smila.scripting.29">ScriptProcessorWorker (bundle org.eclipse.smila.scripting)</span></h1>
<div class="messagebox" style="background-color: #def3fe; border: 1px solid #c5d7e0; color: black; padding: 5px; margin: 1ex 0; min-height: 35px; padding-left: 45px;">
<div style="float: left; margin-left: -40px;"><a href="http://wiki.eclipse.org/File:Note.png" class="image"><img alt="Note.png" src="http://wiki.eclipse.org/images/c/cc/Note.png" width="35" height="35" /></a></div>
<div><b> Available since SMILA 1.3!</b><br /></div>
</div>
<p><br />
The ScriptProcessorWorker is a <a href="../../Glossary.html#W" title="SMILA/Glossary">worker</a> designed to process (synchronous) script calls inside an <a href="../../Glossary.html#W" title="SMILA/Glossary">asynchronous workflow</a>. The worker in principal is independent of a dedicated script processing implementation, however, in SMILA we use <a href="../Scripting.html" title="SMILA/Documentation/Scripting"> scripting with JavaScript</a>.
</p><p>The scripts that can be used for execution are those defined in the SMILA configuration: <tt>&lt;SMILA&gt;/configuration/org.eclipse.smila.scripting/js</tt>
</p><p><br />
</p>
<h2><span class="mw-headline" id="Configuration">Configuration</span></h2>
<p>The ScriptProcessorWorker is configured via incoming task parameters. These parameters can be set, for example, in a <a href="../../Glossary.html#J" title="SMILA/Glossary">job</a> definition.
</p>
<table border="1px solid #CCC" cellpadding="5px" style="border:1px solid #CCC; border-collapse:collapse; font:small/1.5 Tahoma, Bitstream Vera Sans, Verdana, Helvetica, sans-serif;">
<tr>
<th> Parameter
</th>
<th> Description
</th>
<th> Default value
</th></tr>
<tr>
<td> <tt>script</tt>
</td>
<td> Required parameter for the name of the script (= filename without .js extension).
<p>Can be overwritten by each input record containing an attribute "_script" with a single string value to choose a different script to process this record. If this attribute does not specify an existing script (or the value is not a single string), the script given by the task parameters is used to process the record (and a warning is written to the log file).
</p>
</td>
<td> ---
</td></tr>
<tr>
<td> <tt>function</tt>
</td>
<td> Optional parameter for the name of the script function to use for processing records.
<p>Can be overwritten by each input record containing an attribute "_function" with a single string value to choose a different function to process this record. If this attribute value is not valid, the function given by the task parameters is used to process the record (and a warning is written to the logfile).
</p>
</td>
<td> processRecord
</td></tr>
<tr>
<td> <tt>initializeFunction</tt>
</td>
<td> Optional parameter for the name of the script function called once to use for initializing the script. (This parameter cannot be overwritten in the record.)
<p><b>Hint:</b> The script must implement the function - you can leave it empty if you don't need it, but it must be defined!
</p>
</td>
<td> prepare
</td></tr>
<tr>
<td> <tt>writeAttachmentsToOutput</tt>
</td>
<td> Optional parameter. By default, attachments on incoming records are also added to the output records (if any are written). If this parameter is set to <tt>false</tt>, only record metadata is written to the output bulk. This can save a lot of IO if attachments are not needed anymore in the workflow after this worker.
</td>
<td> true
</td></tr>
</table>
<p><br />
Sample job definition that sets these parameters:
</p>
<pre>
{
&quot;name&quot;:&quot;myJob&quot;,
&quot;parameters&quot;:{
&quot;script&quot;: &quot;myScript&quot;,
&quot;function&quot;: &quot;myFunction&quot;,
&quot;initializeFunction&quot;: &quot;myPrepare&quot;,
...
},
&quot;workflow&quot;:&quot;myWorkflow&quot;
}
</pre>
<h2><span class="mw-headline" id="Worker_Definition">Worker Definition</span></h2>
<p>Can be found:
</p>
<ul>
<li> in the configuration file: <tt>configuration/org.eclipse.smila.jobmanager/workers.json </tt>
</li>
<li> via REST API: <tt> GET /smila/jobmanager/workers/scriptProcessor </tt>
</li>
</ul>
<h3><span class="mw-headline" id="Input_.2F_Output">Input / Output</span></h3>
<p>Excerpt from the worker description:
<tt>
</p>
<pre>...
"input": [
{
"name":"input",
"type":"recordBulks"
}
],
"output": [
{
"name":"output",
"type":"recordBulks",
"modes":[
"optional",
"maybeEmpty"
]
}
]
</pre>
<p></tt>
</p><p>The output bucket of the worker is optional, hence in an <a href="../../Glossary.html#W" title="SMILA/Glossary">asynchronous workflow</a> the worker does not need to have a successor. If the output bucket is not defined, the result records of the script processing are not persisted to a bulk, but thrown away. This makes sense if the script stores the records somewhere itself, e.g. adds them to an index.
</p><p>There are two ways to write records to the output bulk:
</p>
<ul>
<li> the script can either return 1 record. If the script returns multiple records, they will be wrapped in one record which is probably what you want.
</li>
<li> to actually return multple records, the script can use the <tt>emit(record)</tt> which is registered in the script scope by the ScriptProcessorWorker (it is not available when scripts are called directly via the ReST API or Scripting Engine Service). The record passed to <tt>emit()</tt> is written to the output bulk immediately so further changes to the record object will not change the written record in the bulk anymore.
</li>
</ul>
<p>If the script neither returns nor emits a record, nothing will be written to the output bulk for the processed input record. Thus it is possible to drop records. It's also perfectly OK to drop all records this way, the task will still be finished as successful in this case.
</p>
<h2><span class="mw-headline" id="Accessing_Task_Parameters_in_Pipelets">Accessing Task Parameters in Pipelets</span></h2>
<p>The worker adds all task parameters to a map in attribute <tt>_parameters</tt> in each record before giving it to the ScriptProcessor, so each pipelet invoked from the script can access them. The helper class <tt>org.eclipse.smila.processing.parameters.ParameterAccesssor</tt> supports this by checking for requested parameters first in this <tt>_parameters</tt> map, then at the top-level of a record and then in the pipelet configuration. Therefore it's possible to override properties from the pipelet configuration by setting them as task parameters, if the pipelet uses the <tt>ParameterAccessor</tt> to access parameters in records and configuration. This is done for example by the <a href="../Bundle_org.eclipse.smila.processing.pipelets.html#org.eclipse.smila.processing.pipelets.SetValuePipelet" title="SMILA/Documentation/Bundle org.eclipse.smila.processing.pipelets">SetValuePipelet</a>.
</p><p>In contrast to the <a href="PipelineProcessingWorker.html" title="SMILA/Documentation/Worker/PipelineProcessingWorker" class="mw-redirect">PipelineProcessingWorker</a>, the worker does not set parameter _failOnError=false to prevent pipelets from throwing exceptions. This was mainly necessary when processing multiple input records in one pipeline call (pipelineRunBulkSize &gt; 1). This is not done by the ScriptProcessingWorker at all, exceptions thrown by scripts and embedded pipelets are handled by the worker.
However, if you need this behavior you can easily set the parameter in your script, provided that the pipelets themselves implement this behavior. How to achieve this is explained in <a href="../../Development_Guidelines/How_to_write_a_Pipelet.html" title="SMILA/Development Guidelines/How to write a Pipelet" class="mw-redirect">How to write a Pipelet</a>.
</p>
<h2><span class="mw-headline" id="Error_Handling">Error Handling</span></h2>
<p>The following errors may occur when a <a href="../../Glossary.html#T" title="SMILA/Glossary">task</a> for the ScriptProcessorWorker is processed:
</p>
<ul>
<li> Parameter sets an invalid value
<ul>
<li> If a script or function parameter is set to an invalid value, the task will fail with a non-recoverable error.
</li>
</ul>
</li>
<li> Errors in prepare
<ul>
<li> If the prepare function fails with a recoverable error, the task will be retried.
</li>
<li> The task will fail for other errors in the prepare function.
</li>
</ul>
</li>
<li> <tt>ScriptingEngineException</tt> while processing a record.
<ul>
<li> Recoverable <tt>ScriptingEngineException</tt>: The current task will fail with a recoverable error, so the whole task (with all records) will be repeated.
</li>
<li> Non-recoverable <tt>ScriptingEngineException</tt>: An error will be logged and the worker will continue with the next record. The current record will be lost. (This is implemented in a way as to <i>not</i> fail the whole task with all its input records in case of a single record defect.)
</li>
<li> However, if <b>all</b> records fail with a non-recoverable error, the task will be finished as failed, too.
</li>
</ul>
</li>
</ul>
<h3><span class="mw-headline" id="Special_Logging">Special Logging</span></h3>
<p>Scripts executed by the ScriptProcessorWorker can use a special log facility named "workerLog". The workerLog supports three log levels (info, warn, error) and for each log level provides three methods, e.g. for level "warn":
</p>
<pre>
workerLog.warn(String message);
workerLog.warn(String message, AnyMap details);
workerLog.warn(String message, Throwable cause);
</pre>
<p><i>Hint</i>: To log exceptions thrown by Java classes (pipelets, services, ...), catch the JavaScript Error and use it's property "javaException" when calling the log method:
</p>
<pre>
try {
// call pipelets or services
} catch (e) {
workerLog.warn(&quot;Error processing record &quot; + record.$id, e.javaException);
}
</pre>
<p>The levels will be written to the SMILA.log like normal log messages (logger category is "org.eclipse.smila.taskworker.TaskLog"), the details object or the causing exception will be appended to the message. Additionally, the number of "warn" messages logged will be reported in the job run data counters for the scriptProcessor worker as "warnCount", so you can see in the job run data, that there might be something in the log file to check for. For example:
</p>
<pre>
{
&quot;endTime&quot;&#160;: &quot;2014-11-07T13:34:56.889+0100&quot;,
&quot;finishTime&quot;&#160;: &quot;2014-11-07T13:34:56.429+0100&quot;,
&quot;jobId&quot;&#160;: &quot;20141107-133456202375&quot;,
&quot;mode&quot;&#160;: &quot;STANDARD&quot;,
&quot;startTime&quot;&#160;: &quot;2014-11-07T13:34:56.255+0100&quot;,
&quot;state&quot;&#160;: &quot;SUCCEEDED&quot;,
&quot;workflowRuns&quot;&#160;: {
&quot;activeWorkflowRunCount&quot;&#160;: 0,
...
},
&quot;tasks&quot;&#160;: {
&quot;createdTaskCount&quot;&#160;: 2,
...
},
&quot;worker&quot;&#160;: {
&quot;1_scriptProcessor&quot;&#160;: {
&quot;warnCount&quot;&#160;: 3,
&quot;duration&quot;&#160;: 0.079656584,
...
</pre>
<h3><span class="mw-headline" id="Other_Extras">Other Extras</span></h3>
<ul>
<li> The <tt>org.eclipse.smila.taskworker.TaskContext</tt> object of the current worker task can be access via global property "taskContext". For example this makes it possible to access the task properties (job name and run id etc.):
</li>
</ul>
<pre>
var jobRunId = taskContext.getTask().getProperties().get(&quot;jobRunId&quot;);
</pre>
<!--
NewPP limit report
CPU time usage: 0.120 seconds
Real time usage: 0.161 seconds
Preprocessor visited node count: 109/1000000
Preprocessor generated node count: 354/1000000
Post‐expand include size: 819/2097152 bytes
Template argument size: 113/2097152 bytes
Highest expansion depth: 5/40
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key my_wiki:pcache:idhash:45968-0!*!0!!en!2!* and timestamp 20150414084519 and revision id 373973
-->
</div>
<!-- catlinks -->
<div id='catlinks' class='catlinks catlinks-allhidden'></div> <!-- /catlinks -->
</div>
</div>
</div>
</div>
<!-- /maincontent -->
<!-- printfooter -->
<div class="printfooter">
Retrieved from "<a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;oldid=373973">http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Worker/ScriptProcessorWorker&amp;oldid=373973</a>" </div>
<!-- /printfooter -->
<!-- debughtml -->
<!-- /debughtml -->
</div>
<!-- /bodyContent -->
</section>
<!-- /content -->
<!-- footer -->
</div> <section id="footer-contribution-info" style="border-top:1px solid #ccc;" class="footer-offset background-white margin-top-25"><div class="container text-center padding-top-10 padding-bottom-10"><p id="footercredit">This page was last modified 07:08, 20 November 2014 by <a href="http://wiki.eclipse.org/User:Juergen.schumacher.empolis.com" title="User:Juergen.schumacher.empolis.com">Juergen Schumacher</a>. Based on work by <a href="http://wiki.eclipse.org/index.php?title=User:Nadine.auslaender.empolis.com&amp;action=edit&amp;redlink=1" class="new" title="User:Nadine.auslaender.empolis.com (page does not exist)">Nadine Ausländer</a> and <a href="http://wiki.eclipse.org/User:Andreas.weber.empolis.com" title="User:Andreas.weber.empolis.com">Andreas Weber</a>.</p><p id="footerviews">This page has been accessed 968 times.</p></div></section> </main> <!-- /#main-content-container-row -->
<p id="back-to-top" class="noprint hidden-print">
<a class="visible-xs" href="ScriptProcessorWorker.html#top">Back to the top</a>
</p>
<footer role="contentinfo" class="noprint hidden-print">
<div class="container">
<div class="row">
<section id="footer-eclipse-foundation" class="col-xs-offset-1 col-xs-11 col-sm-7 col-md-6 col-md-offset-0">
<h2 class="section-title">Eclipse Foundation</h2>
<ul class="nav">
<li><a href="https://eclipse.org/org/">About us</a></li>
<li><a href="https://eclipse.org/org/foundation/contact.php">Contact Us</a></li>
<li><a href="https://eclipse.org/donate">Donate</a></li>
<li><a href="https://eclipse.org/org/documents/">Governance</a></li>
<li><a href="https://eclipse.org/artwork/">Logo and Artwork</a></li>
<li><a href="https://eclipse.org/org/foundation/directors.php">Board of Directors</a></li>
</ul>
</section>
<section id="footer-legal" class="col-xs-offset-1 col-xs-11 col-sm-7 col-md-6 col-md-offset-0">
<h2 class="section-title">Legal</h2>
<ul class="nav">
<li><a href="https://eclipse.org/legal/privacy.php">Privacy Policy</a></li>
<li><a href="https://eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
<li><a href="https://eclipse.org/legal/copyright.php">Copyright Agent</a></li>
<li><a href="https://eclipse.org/org/documents/epl-v10.php">Eclipse Public License </a></li>
<li><a href="https://eclipse.org/legal/">Legal Resources </a></li>
</ul>
</section>
<section id="footer-useful-links" class="col-xs-offset-1 col-xs-11 col-sm-7 col-md-6 col-md-offset-0">
<h2 class="section-title">Useful Links</h2>
<ul class="nav">
<li><a href="https://bugs.eclipse.org/bugs/">Report a Bug</a></li>
<li><a href="http://help.eclipse.org/">Documentation</a></li>
<li><a href="https://eclipse.org/contribute/">How to Contribute</a></li>
<li><a href="https://eclipse.org/mail/">Mailing Lists</a></li>
<li><a href="https://eclipse.org/forums/">Forums</a></li>
<li><a href="http://marketplace.eclipse.org/">Marketplace</a></li>
</ul>
</section>
<section id="footer-other" class="col-xs-offset-1 col-xs-11 col-sm-7 col-md-6 col-md-offset-0">
<h2 class="section-title">Other</h2>
<ul class="nav">
<li><a href="https://eclipse.org/ide/">IDE and Tools</a></li>
<li><a href="https://eclipse.org/projects">Community of Projects</a></li>
<li><a href="https://eclipse.org/org/workinggroups/">Working Groups</a></li>
</ul>
<ul class="list-inline social-media">
<li><a href="https://twitter.com/EclipseFdn"><i class="fa fa-twitter-square"></i></a></li>
<li><a href="https://plus.google.com/+Eclipse"><i class="fa fa-google-plus-square"></i></a></li>
<li><a href="https://www.facebook.com/eclipse.org"><i class="fa fa-facebook-square"></i> </a></li>
<li><a href="https://www.youtube.com/user/EclipseFdn"><i class="fa fa-youtube-square"></i></a></li>
</ul>
</section>
<div id="copyright" class="col-xs-offset-1 col-sm-14 col-md-24 col-md-offset-0">
<div>
<span><img src="http://eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-logo-bw-800x188.png" alt="Eclipse.org black and white logo" width="166" height="39" id="logo-eclipse-white"/></span>
<p id="copyright-text">Copyright &copy; 2014 The Eclipse Foundation. All Rights Reserved.</p>
</div>
</div>
<a href="ScriptProcessorWorker.html#" class="scrollup">Back to the top</a>
</div>
</div>
</footer>
<script src="http://wiki.eclipse.org/skins/solstice/public/javascript/main.min.js"></script>
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-910670-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script> <!-- /footer -->
<script>/*<![CDATA[*/window.jQuery && jQuery.ready();/*]]>*/</script><script>if(window.mw){
mw.loader.state({"skins.solstice":"loading","site":"ready","user":"ready","user.groups":"ready"});
}</script>
<script src="http://wiki.eclipse.org/load.php?debug=false&amp;lang=en&amp;modules=skins.solstice&amp;only=scripts&amp;skin=solstice&amp;*"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.searchSuggest"],null,true);
}</script>
<script>if(window.mw){
mw.config.set({"wgBackendResponseTime":378});
}</script> </body>
</html>