How to run the MetaServlet action "runTask" with "taskName"

Overview

Can we run a task by its taskName, not by its taskId, as the taskId is not transparent on the TAC interface?

 

Environment

This action, runTask, exists in all supported versions of Talend products.

 

Symptoms/Description

To read help information about scripts for calling MetaServlet actions in the Windows command line/Linux terminal, use the command:

MetaservletCaller.bat --tac-url=http:/ /IP_address:port/WebApplicationName --help CommandName

 

For runTask, it will be displayed as follows:

----------------------------------------------------------
Command: runTask
----------------------------------------------------------
Description             : Allows to run a task defined in Job conductor by its id. Mode can be 'asynchronous' or 'synchronous'
Requires authentication : true
Since                   : 4.2
Sample                  : 
{
  "actionName": "runTask",
  "authPass": "admin",
  "authUser": "admin@company.com",
  "mode": "synchronous",
  "taskId": 1
}
Specific error codes    : 
       30: Error while launching task
       31: Thread interupted while running
       32: No right to run this task
       33: The parameter 'mode' must have the value 'synchronous' or 'asynchronous'

Generic return codes    : 
       0: Success
       1: Unknown error
       2: Invalid request
       3: Authentication error
       4: License problem
       5: Invalid parameter
       6: Error formatting response

 

Resolution

Since taskId is not transparent on TAC interface, you can do one of the following:

  • Make it visible in the TAC Job conductor view.

    DisplayTaskId.png

  • Or use getTaskByName:

    getTaskIdByName.png

    Then use runTask:

    runTask.png

     

    Also, for the external scheduler, it has to parse the JSON expression from getTaskIdByName and call runTask with additional arguments.

 

Related Jira Issues

TMC-6160 Run MetaServlet "runTask" with "taskName"

 

Bookshelf references

For more details on Metaservlet actions, refer to the online documentation:

Non-GUI operation in metaServlet

Version history
Revision #:
6 of 6
Last update:
‎05-17-2017 03:05 AM
Updated by:
 
Labels (1)
Tags (1)