| Tasks {sevenbridges2} | R Documentation |
R6 Class representing tasks endpoints
Description
R6 Class representing tasks resource endpoints.
Super class
sevenbridges2::Resource -> Tasks
Public fields
URLList of URL endpoints for this resource.
Methods
Public methods
Method new()
Create new Tasks resource object.
Usage
Tasks$new(...)
Arguments
...Other response arguments.
Method query()
This call lists all tasks you can access.
Read more about how to use query parameters properly
here.
Usage
Tasks$query(
status = NULL,
parent = NULL,
project = NULL,
created_from = NULL,
created_to = NULL,
started_from = NULL,
started_to = NULL,
ended_from = NULL,
ended_to = NULL,
order_by = c("created_time", "start_time", "name", "end_time", "created_by"),
order = c("asc", "desc"),
origin_id = NULL,
limit = getOption("sevenbridges2")$limit,
offset = getOption("sevenbridges2")$offset,
...
)Arguments
statusYou can filter the returned tasks by their status. Set the value of status to one of the following values:
QUEUED,DRAFT,RUNNING,COMPLETED,ABORTED,FAILED.parentProvide task ID or Task object of the parent task to return all child tasks from that parent. A parent task is a task that specifies criteria by which to batch its inputs into a series of further sub-tasks, called child tasks. See the documentation on batching tasks for more details on how to run tasks in batches.
projectProvide the project ID or Project object you wish to list the tasks from.
created_fromEnter the starting date string for querying tasks created on the specified date and onwards.
created_toEnter the ending date string for querying tasks created until the specified date. You can use it in combination with
created_fromto specify a time interval.started_fromEnter the starting date string for querying tasks started on the specified date and onwards.
started_toEnter the ending date string for querying tasks started until the specified date.
ended_fromEnter the starting date string for querying tasks that ended on a specified date.
ended_toEnter the ending date string for querying tasks that ended until a specified date.
order_byOrder returned results by the specified field. Allowed values:
created_time,start_time,name,end_timeandcreated_by.
Sort can be done only by one column. The default value iscreated_time.orderSort results in ascending or descending order by specifying
ascordesc, respectively. Only taken into account iforder_byis explicitly specified. The default value isasc.origin_idEnter an automation run ID to list all tasks created from the specified automation run.
limitThe maximum number of collection items to return for a single request. Minimum value is
1. The maximum value is100and the default value is50. This is a pagination-specific attribute.offsetThe zero-based starting index in the entire collection of the first item to return. The default value is
0. This is a pagination-specific attribute....Other arguments that can be passed to core
api()function like 'fields', etc.
Returns
Collection of Task objects.
Method get()
This call returns details of the specified task. The task is referred to by its ID, which you can obtain by making the call to list all tasks you can access. The task details include its creator, its start and end time, the number of jobs completed in it, and its input and output files. You can also see the status of the task.
Usage
Tasks$get(id, ...)
Arguments
idThe ID of the task you are querying.
...Other arguments that can be passed to core
api()function like 'fields', etc.
Returns
Task object.
Method delete()
This call deletes a task from the Seven Bridges Platform.
Tasks are specified by their IDs, which you can obtain by using
Tasks$query() to list tasks or by getting a single task
using Tasks$get().
Usage
Tasks$delete(task, ...)
Arguments
taskTaskobject or task ID....Other arguments that can be passed to core
api()function as 'fields', etc.
Method create()
This call creates a new task. You can create either a single task or a batch task by using the app's default batching, override batching, or disable batching completely. A parent task is a task that specifies criteria by which to batch its inputs into a series of further sub-tasks, called child tasks. the documentation on batching tasks for more details on batching criteria.
Usage
Tasks$create( project, app, revision = NULL, name = NULL, description = NULL, execution_settings = NULL, inputs = NULL, output_location = NULL, batch = NULL, batch_input = NULL, batch_by = NULL, use_interruptible_instances = NULL, action = NULL, ... )
Arguments
projectThe ID of a project or a Project object where you want to create the task in.
appThe ID of an app or an App object you want to run. Recall that apps are specified by their projects, in the form
<project_id>/<app_name>.revisionThe app revision (version) number.
nameThe name of the task.
descriptionAn optional description of the task.
execution_settingsNamed list with detailed task execution parameters. Detailed task execution parameters:
-
instance_type: Possible value is the specific instance type, e.g."instance_type" = "c4.2xlarge;ebs-gp2;2000"; -
max_parallel_instances: Maximum number of instances running at the same time. Takes any integer value equal to or greater than 1, e.g."max_parallel_instances" = 2.; -
use_memoization: Set toFALSEby default. Set toTRUEto enable memoization; -
use_elastic_disk: Set toTRUEto enable Elastic Disk.
Here is an example:
execution_settings <- list( "instance_type" = "c4.2xlarge;ebs-gp2;2000", "max_parallel_instances" = 2, "use_memoization" = TRUE, "use_elastic_disk" = TRUE )
-
inputsList of objects. See the section on specifying task inputs for information on creating task input objects. Here is an example with various input types:
inputs <- list( "input_file"= "<file_id/file_object>", "input_directory" = "<folder_id/folder_object>", "input_array_string" = list("<string_elem_1>", "<string_elem_2>"), "input_boolean" = TRUE, "input_double" = 54.6, "input_enum" = "enum_1", "input_float" = 11.2, "input_integer" = "asdf", "input_long" = 4212, "input_string" = "test_string", "input_record" = list( "input_record_field_file" = "<file_id/file_object>", "input_record_field_integer" = 42 ) )output_locationThe output location list allows you to define the exact location where your task outputs will be stored. The location can either be defined for the entire project using the main_location parameter, or individually per each output node, by setting the nodes_override parameter to true and defining individual output node locations within nodes_location. See below for more details.
-
main_location- Defines the output location for all output nodes in the task. Can be a string path within the project in which the task is created, for example
/Analysis/<task_id>_<task_name>/
or a path on an attached volume, such as
volumes://volume_name/<project_id>/html.
Parts of the path enclosed in angle brackets <> are tokens that are dynamically replaced with corresponding values during task execution. -
main_location_alias: The string location (path) in the project that will point to the actual location where the outputs are stored. Used if main_location is defined as a volume path (starting with volumes://), to provide an easy way of accessing output data directly from project files. -
nodes_override: Enables defining of output locations for output nodes individually through nodes_location (see below). Set toTRUEto be able to define individual locations per output node. Default:FALSE. Even if nodes_override is set toTRUE, it is not necessary to define output locations for each of the output nodes individually. Data from those output nodes that don't have their locations explicitly defined through nodes_location is either placed in main_location (if defined) or at the project files root if a main output location is not defined for the task. -
nodes_location: List of output paths for individual task output nodes in the following format for each output node:
<output-node-id> = list(
"output_location" = "<output-path>",
"output_location_alias" = "<alias-path>"
)
Example:b64html = list( "output_location" = "volumes://outputs/tasks/mar-19", "output_location_alias" = "/rfranklin/tasks/picard" )
In the example above, b64html is the ID of the output node for which you want to define the output location, while the parameters are defined as follows:
-
output_location- Can be a path within the project in which the task is created, for example/Analysis/<task_id>_<task_name>/or a path on an attached volume, such asvolumes://volume_name/<project_id>/html. Also accepts tokens. -
output_location_alias- The location (path) in the project that will point to the exact location where the output is stored. Used if output_location is defined as a volume path (starting with volumes://).
-
-
batchThis is set to
FALSEby default. Set toTRUEto create a batch task and specify thebatch_inputandbatch-bycriteria as described below.batch_inputThe ID of the input on which you wish to batch. You would typically batch on the input consisting of a list of files. If this parameter is omitted, the default batching criteria defined for the app will be used.
batch_byBatching criteria in form of list. For example:
batch_by = list( type = "CRITERIA", criteria = list("metadata.condition") )use_interruptible_instancesThis field can be
TRUEorFALSE. Set this field toTRUEto allow the use of spot instances.actionIf set to
run, the task will be run immediately upon creation....Other arguments that can be passed to core
api()function like 'fields', etc.
Returns
Task object.
Method bulk_get()
This call returns statistics for all specified tasks.
Usage
Tasks$bulk_get(tasks)
Arguments
tasksA list of
Taskobjects or list of strings (IDs) of the tasks you are requesting the statistics for.
Returns
Collection (list of Task objects).
Examples
\dontrun{
# Get details of multiple tasks
a$tasks$bulk_get(
tasks = list("task_1_ID", "task_2_ID")
)
}
Method clone()
The objects of this class are cloneable with this method.
Usage
Tasks$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `Tasks$bulk_get`
## ------------------------------------------------
## Not run:
# Get details of multiple tasks
a$tasks$bulk_get(
tasks = list("task_1_ID", "task_2_ID")
)
## End(Not run)