| App {sevenbridges2} | R Documentation |
R6 Class representing an app
Description
R6 Class representing a resource for managing apps.
Super class
sevenbridges2::Item -> App
Public fields
URLList of URL endpoints for this resource.
idCharacter used as an app ID - short app name.
projectProject ID if any, when returned by an API call.
nameApp name.
revisionApp's revision number.
copy_ofThe original application of which this is a copy.
latest_revisionApp's latest revision number.
rawApp's raw CWL (JSON or YAML).
Methods
Public methods
Method new()
Create a new App object.
Usage
App$new(res = NA, ...)
Arguments
resResponse containing App object information.
...Other response arguments.
Returns
A new App object.
Method print()
Print method for App class.
Usage
App$print()
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$print()
}
Method reload()
Reload App object information. Suitable also for loading raw CWL in the 'raw' field, if it's not already populated.
Usage
App$reload(...)
Arguments
...Other arguments that can be passed to core
api()function like 'fields', etc.
Returns
App object.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$reload()
}
Method copy()
A method that copies the current app to the specified project.
Usage
App$copy(project, name = NULL, strategy = "clone", use_revision = FALSE, ...)
Arguments
projectProject object or project ID. If you opt for the latter, remember that the project ID should be specified in
<project_owner>/<project-name>format, e.g.
rfranklin/my-project, or as<division>/<project-name>depending on the account
type.nameThe new name the app will have in the target project. Optional.
strategyThe method for copying the app. Supported strategies:
-
clone- copy all revisions; get updates from the same app as the copied app (default) -
direct: copy latest revision; get updates from the copied app -
clone_direct: copy all revisions; get updates from the copied app -
transient: copy latest revision; get updates from the same app as the copied app.
-
use_revisionParameter specifying which app's revision should be copied. If set to
FALSE(default), the latest revision of the app will be copied....Other arguments that can be passed to core
api()function like 'fields', etc.
Returns
Copied App object.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$copy(project)
}
Method get_revision()
Get app's revision.
Usage
App$get_revision(revision = self$revision, in_place = FALSE, ...)
Arguments
revisionRevision of the app.
in_placeIf
TRUE, replace current app object with new for specified app revision....Other arguments that can be passed to core
api()function like 'fields', etc.
Details
This call allows you to obtain a particular revision of an app, which is not necessarily the most recent version.
Returns
App object.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$get_revision()
}
Method create_revision()
Create a new app revision.
Usage
App$create_revision(
raw = NULL,
from_path = NULL,
raw_format = c("JSON", "YAML"),
in_place = FALSE,
...
)Arguments
rawA list containing a raw CWL for the app revision you are about to create. To generate such a list, you might want to load some existing JSON / YAML file. In case that your CWL file is in JSON format, please use the
fromJSONfunction from thejsonlitepackage to minimize potential problems with parsing the JSON file. If you want to load a CWL file in YAML format, it is highly recommended to use theread_yamlfunction from theyamlpackage. Keep in mind that this parameter should not be used together with thefile_pathparameter.from_pathA path to a file containing the raw CWL for the app (JSON or YAML). This parameter should not be used together with the
rawparameter.raw_formatThe type of format used (JSON or YAML).
in_placeIf
TRUE, replace current app object with newly created revision....Other arguments that can be passed to core
api()function like 'fields', etc.
Details
This call creates a new revision for an existing app. It adds a new CWL
app description, and stores it as the named revision for the specified
app. The revision number must not already exist and should follow the
sequence of previously created revisions.
More documentation about how to create the app via API can be found
here.
Returns
App object.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
# Create App object using raw CWL
app_object$create_revision(raw)
}
Method sync()
Synchronize a copied app with its parent app.
Usage
App$sync(...)
Arguments
...Other arguments that can be passed to core
api()function like 'fields', etc.
Details
This call synchronizes a copied app with the source app from which it has been copied.
Returns
App object.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$sync()
}
Method input_matrix()
Get inputs matrix for the app - what are expected inputs required or not, with their details about the expected types, descriptions etc.
Usage
App$input_matrix()
Returns
Data frame.
Method output_matrix()
Get outputs matrix for the app - what are the expected outputs of the task running this app, with their details about the expected types, descriptions etc.
Usage
App$output_matrix()
Returns
Data frame.
Method create_task()
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
App$create_task( project, revision = NULL, name = NULL, description = NULL, execution_settings = NULL, inputs = NULL, output_location = output_location, batch = NULL, batch_input = NULL, batch_by = NULL, use_interruptible_instances = NULL, action = NULL, ... )
Arguments
projectThe ID string of a project or a Project object where you want to create the task in.
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 asvolumes://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.
Examples
\dontrun{
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
# Create a DRAFT task
app_object$create_task(project = project)
}
Method clone()
The objects of this class are cloneable with this method.
Usage
App$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `App$print`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$print()
## End(Not run)
## ------------------------------------------------
## Method `App$reload`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$reload()
## End(Not run)
## ------------------------------------------------
## Method `App$copy`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$copy(project)
## End(Not run)
## ------------------------------------------------
## Method `App$get_revision`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$get_revision()
## End(Not run)
## ------------------------------------------------
## Method `App$create_revision`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
# Create App object using raw CWL
app_object$create_revision(raw)
## End(Not run)
## ------------------------------------------------
## Method `App$sync`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
app_object$sync()
## End(Not run)
## ------------------------------------------------
## Method `App$create_task`
## ------------------------------------------------
## Not run:
# x is API response when app is requested
app_object <- App$new(
res = x,
href = x$href,
auth = auth,
response = attr(x, "response")
)
# Create a DRAFT task
app_object$create_task(project = project)
## End(Not run)