Task-class: Task class

Description Details Fields Examples

Description

Task class

Details

A task execution require auth, project_id, pipeline_id and inputs parameters, there are two ways to execute a task, the recommended way is to use a cascading method to create a project object called p then just call p$task_run() to pass your parameters. This way you save your time passing auth and project_id. The other way is to create a Task object with all required fields and call run method. Please check example in the end or tutorial for easy API.

Fields

id

[characterORNULL] The task ID number, used when referring to the task in other Seven Bridges API calls

name

[characterORNULL] Name of the task you wish to execute. If this is not specified, the task will be named automatically.

description

[characterORNULL] Description of the task you wish to execute.

pipeline_id

[characterORNULL] ID of the pipeline you wish to execute.

pipeline_revision

[characterORNULL] Revision number of the pipeline you wish to execute. If this is not specified, the latest pipeline revision is used.

start_time

[numericORNULL] start time.

status

[characterORNULL] 1) active: task is currently running. 2) completed: task has finished successfully. 3) aborted: task was aborted by user. 4) failed: task has failed to finish due to either bad inputs and/or parameters, or because of the internal infrastructure failures.

message

[characterORNULL] task message

jobs_completed

[numericORNULL] completed jobs

jobs_total

[numericORNULL] total jobs.

inputs

[listORNULL] required for task execution. List of key-value pairs containing mappings of pipeline input node ID to file IDs. Note that you must supply an array of file IDs for each input nodes, even if the array is empty.

parameters

[listORNULL] required for task execution. List of key-value pairs containing mappings of node IDs to apps specific parameters. Note that you must supply some value for parameters, even if this an empty list of key-value pairs.

project_id

[characterORNULL] required for task execution. ID of the project you want to execute the task in.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
token <- "aef7e9e3f6c54fb1b338ac4ecddf1a56"
a <- Auth(token)
## A task constructor
Task(auth = Auth(token),
              name = "my task",
              description = "A text description",
              pipeline_id = "fake_pipeline_id",
              project_id = "fake_project_id",
              inputs = list(
                  "177252" = list("fake_id")
                  ))

## replace with real token then follow the examples here
## get billing info
b <- a$billing()
p <- a$project("API")
## get the pipeline from your project not public one
f.pipe <- p$pipeline(name = "FastQC")
## check the inputs needed for running tasks
f.pipe$details()
## Ready to run a task? go
f.task <- p$task_run(name = "my task",
                      description = "A text description",
                      pipeline_id = f.pipe$id,
                      inputs = list(
                          "177252" = list(f.file$id)
                          ))
f.task$run()
## or you can just run with Task constructor
f.task <- Task(auth = Auth(token),
               name = "my task",
               description = "A text description",
               pipeline_id = f.pipe$id,
               project_id = p$id,
               inputs = list(
                   "177252" = list(f.file$id)
                   ))
## Monitor you task
f.task$monitor(30)

## download a task output files
f.task <- p$task("my task")
f.task$download("~/Desktop/")

## Abort the task
f.task$abort()

sbgr documentation built on Oct. 5, 2016, 4:14 a.m.