# Adding an execution task to an artifact

Talend Administration Center also allows you to add execution tasks to Jobs that are retrieved on the artifact repository at execution time.

## Before you begin

* With this procedure, Talend Administration Center is able to fetch all Jobs in a continuous way- even after the database is restored on a new server.
* The parameters to connect to the artifact repository are filled in the Artifact Repository node of the Configuration page. For more information, see [Setting up the artifact repository parameters](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/setting-up-artifact-repository-parameters).
* The Job you want to add has been previously published to the artifact repository from Talend Studio.
* Unix only: If you want to execute the Job as a specific Operating System user (Run Job as OS user option), this user must already exist in the system, they must have the right umask and some server directories must have been given specific permissions. For more information, see [Configuring user impersonation for Talend JobServer](https://help.qlik.com/talend/en-US/installation-guide-linux/8.0/config-user-impersonation).

  Information noteTip: By default, the username must start with a lower-case letter from a to z, followed by a combination of lower-case letters (a to z) and numbers (from 0 to 9). To allow using characters other than those letters and numbers, you need to modify the regular expression ^[a-z][-a-z0-9]\*\$ in the value of the org.talend.remote.jobserver.server.TalendJobServer.RUN\_AS\_USER\_VALIDATION\_REGEXP parameter in the file {Job\_Server\_Installation\_Folder}\agent\conf\TalendJobServer.properties. For example:
  * To define a username pattern that should include a dot, like firstname.lastname, modify the regular expression to ^[a-z][-a-z0-9]\*.[a-z][-a-z0-9]\*\$.
  * To allow using one or more underscores (\_) in the username, modify the regular expression to ^[a-z][-a-z\_0-9]\*\$.

## Procedure

1. From the toolbar on the Job Conductor page, click Add &gt; Artifact Task to display the Execution task configuration panel.
   ### Example

   ![Execution task configuration panel.](https://help.qlik.com/talend/en-US/administration-center-user-guide/Resources/images/tac-job_conductor-artifact_task_form.png)
2. Enter/select the following information as necessary.
   | Field | Description |
   | --- | --- |
   | Label | Name of the task to be triggered. |
   | Description | Provides any useful information regarding the task to be<br>carried out. |
   | Active | Select/clear this checkbox to activate/deactivate this task. |
   | Job | Click the Artifact repository<br>button icon to open the Select artifact from<br>Artifact repository window. This window<br>allows you to link dynamically the Job artifact and to<br>associate it to the task, knowing that this artifact is<br>only retrieved at execution time.<br><br>In the Repository list, select the<br>repository in which the Job is published. In the<br>Browse panel, browse to the<br>Job you want to associate with the task then click<br>OK to close the window. |
   | Project | The project containing the artifact to be executed. This<br>field is automatically completed and is read-only. |
   | Branch | The GIT branch/tag, if any is created, of the project<br>containing the artifact to be executed. For more<br>information about projects stored on GIT, see [Managing Git branches and tags for a project](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/managing-svn-git-branches-and-tags-for-project). This field is automatically completed and is<br>read-only. |
   | Repository | Repository in which the artifact is published. This field<br>is automatically completed and is read-only. |
   | Group ID | Name of the group in which the artifact is published.<br>This field is automatically completed and is<br>read-only. |
   | Artifact | Name of the artifact item. This field is automatically<br>completed and is read-only.<br><br>From this field, you can select both<br>Standard and Big Data Batch Jobs (Map/Reduce and Spark),<br>according to your license. |
   | Publish Version | Version of the artifact to be executed. This field is<br>automatically completed and is read-only. |
   | Use Latest Version | If there are several versions of the same artifact, select this<br>checkbox to automatically execute the latest version of the<br>selected artifact.<br><br><ul> <li>When this checkbox is checked, the <span>Publish                                          Version</span> field is hidden in the UI, and the                                       task fetches the most recent available version of the                                       artifact, for example <span>0.3.0</span>.</li> <li>When this checkbox is unchecked, the <span>Publish                                          Version</span> field shows a specific value, for                                       example <span>0.2.0</span>. The task will check for                                       the latest file in that version.</li> </ul><br><br>In the Metaservlet, nexusVersion="LATEST" and<br>artifactoryVersion="LATEST" represent the<br>latest artifact version. |
   | Context | Context to be applied to the execution task. This field<br>is automatically completed.<br><br>If you want to change the context with the "Apply context to<br>children" option selected, you must go to Talend Studio to rebuild the Job. |
   | Apply context to children | This field is automatically completed and is read-only. It can be<br>set when the Job is published from Talend Studio as a standalone Job. |
   | Log4j Level | Select the level of log you want to apply to the<br>execution task. The levels are ranked in increasing<br>order of severity, from TRACE (most detailed<br>information) to OFF (logs turned off). |
   | Execution server | Select the server on which the task should be deployed.<br><br>If the relevant server does not display on the list,<br>check the Servers page and make<br>sure the server is correctly configured. For more<br>information regarding the execution server<br>configuration, see [Configuring execution servers](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/configuring-execution-servers).<br><br>The list of execution servers offers virtual servers<br>corresponding to physical servers grouped together. For<br>details about Virtual Servers,<br>see [Configuring virtual servers](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/configuring-virtual-servers). |
   | Run Job as OS user (Unix)<br><br>(Unix only) | Enter the name of the Operating System user who is<br>allowed to start the Job execution,<br>root for example:<br><br><ul> <li>If the field is empty, any user is allowed to                                                execute the Job. Note that these users must                                                correspond to existing Operating System users. </li> <li>To restrict this right to specific users, edit the                                                list of allowed users in the following file:<p> <kbd>&lt;JobServerInstallationDirectory&gt;/conf/TalendJobServer.properties</kbd> </p> </li> <li>You need to give the right umask to your user as                                                well as specific permissions to the server                                                directories to use this feature. </li> </ul><br><br>Information noteTip: By default, the username must start with a<br>lower-case letter from a to z, followed by a combination of<br>lower-case letters (a to z) and numbers (from<br>0 to 9). To allow using characters other than those<br>letters and numbers, you need to modify the regular expression<br>^[a-z][-a-z0-9]\*\$ in the value of the<br>org.talend.remote.jobserver.server.TalendJobServer.RUN\_AS\_USER\_VALIDATION\_REGEXP<br>parameter in the file<br>{Job\_Server\_Installation\_Folder}\agent\conf\TalendJobServer.properties.<br>For example:<br><br><ul> <li>To define a username pattern that should include a dot, like            <span>firstname.lastname</span>, modify the regular expression to            <span>^[a-z][-a-z0-9]*.[a-z][-a-z0-9]*\$</span>.</li> <li>To allow using one or more underscores (<span>_</span>) in the username, modify the          regular expression to <span>^[a-z][-a-z_0-9]*\$</span>.</li> </ul> |
   | Statistic | This field is automatically completed for new tasks. The initial<br>value depends on the statistics settings available for the Job and<br>on the default configuration of Talend Administration Center. You can change the value before you save the task. |
   | On unavailable JobServer | This option is part of the failover process provided by Qlik. and allows you to decide what action you want to take on the<br>selected task when the server is unavailable during a predetermined<br>period of time (defined in [Adding an execution server](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/adding-execution-server)).<br><br>Select one of the following from the list. The default<br>value is Reset task.<br><br><ul> <li> <span>Wait</span>: if the Job has an                                                unknown status, usually caused by server problems,                                                this option puts the task on hold throughout the                                                period of time during which the server is                                                inaccessible. When the server is accessible again,                                                the task will restore the status it held prior to                                                encountering the problem.</li> <li> <span>Reset task</span>: if the Job has an                                                unknown status, usually caused by server problems,                                                this option puts the task status back to                                                  <kbd>Ready to run</kbd> when the                                                predetermined period of time relating to the Job                                                status elapses. However, the Job itself could                                                continue running depending on the initial                                                problem.</li> <li> <span>Restart task</span>: if the Job has                                                an unknown status, usually caused by server                                                problems, this option will automatically start the                                                task in its original state when the predetermined                                                period of time relating to the Job status                                                  elapses.<div><span>Information note</span><span>Note:</span> The <span>Restart task</span> option is                                                  only useful when you are using virtual                                                  servers.</div> </li> <li> <span>Recover task</span>: if the Job has                                                an unknown status, usually caused by server                                                problems, this option will automatically recover the                                                Job execution from the last validated                                                  checkpoint.<div><span>Information note</span><span>Note:</span> The context parameters used when the task is                                                  reset, restarted or recovered, are the same as                                                  those used during the last execution </div> </li> </ul> |
   | Timeout (s) | Type in how long to wait, in seconds, before the task is<br>killed.<br><br>By default, if no value is entered in the field, the task<br>runs indefinitely. This option might be useful if you<br>need to limit the execution of a task to a certain<br>period of time. |
   | Pause triggers on error | Select the checkbox in order to pause the trigger(s) if an error<br>occurs during the execution of the task. |
3. Click Save to validate the configuration or Cancel to cancel the creation of the task.

   Once the task has been created, you can still edit its properties, manually, or using the Metaservlet application. For more information, see [Editing a task](https://help.qlik.com/talend/en-US/administration-center-user-guide/8.0/editing-task).

## Results

Information noteTip: If the Artifactory (Nexus 2/Nexus 3/Artifact) is down, you can use the parameter named use.local.job.when.download.failed.from.artifact.repository=true to reuse locally cached Jobs to run successfully tasks.