Skip to contents

R6 Class representing a resource for managing apps.

Super class

sevenbridges2::Item -> App

Public fields

URL

List of URL endpoints for this resource.

id

Character used as an app ID - short app name.

project

Project ID if any, when returned by an API call.

name

App name.

revision

App's revision number.

copy_of

The original application of which this is a copy.

latest_revision

App's latest revision number.

raw

App's raw CWL (JSON or YAML).

Methods


Method new()

Create a new App object.

Usage

App$new(res = NA, ...)

Arguments

res

Response 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

project

Project 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.

name

The new name the app will have in the target project. Optional.

strategy

The 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_revision

Parameter 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

revision

Revision of the app.

in_place

If 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

raw

A 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 fromJSON function from the jsonlite package 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 the read_yaml function from the yaml package. Keep in mind that this parameter should not be used together with the file_path parameter.

from_path

A path to a file containing the raw CWL for the app (JSON or YAML). This parameter should not be used together with the raw parameter.

raw_format

The type of format used (JSON or YAML).

in_place

If 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

project

The ID string of a project or a Project object where you want to create the task in.

revision

The app revision (version) number.

name

The name of the task.

description

An optional description of the task.

execution_settings

Named 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 to FALSE by default. Set to TRUE to enable memoization;

  • use_elastic_disk: Set to TRUE to 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
  )

inputs

List 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_location

The 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 to TRUE to be able to define individual locations per output node. Default: FALSE. Even if nodes_override is set to TRUE, 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 as volumes://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://).

batch

This is set to FALSE by default. Set to TRUE to create a batch task and specify the batch_input and batch-by criteria as described below.

batch_input

The 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_by

Batching criteria in form of list. For example:

batch_by = list(
  type = "CRITERIA",
  criteria = list("metadata.condition")
)

use_interruptible_instances

This field can be TRUE or FALSE. Set this field to TRUE to allow the use of spot instances.

action

If 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

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `App$print`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$reload`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$copy`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$get_revision`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$create_revision`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$sync`
## ------------------------------------------------

if (FALSE) {
 # 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 `App$create_task`
## ------------------------------------------------

if (FALSE) {
 # 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)
}