I/O and Run Specifications
When creating an executable on DNAnexus, you need to define three key specifications that control how it works.
The input specification defines what data the executable expects to receive.
The output specification defines the results it produces.
The run specification defines the resources and instructions needed to execute it.
For applets, these specifications are optional but must be provided when you create the applet. Once created, applets enter a "closed" state where these specifications cannot be changed.
For apps, both input and output specifications are required. This requirement ensures apps can work together when one app's output matches another app's input requirements. Unlike applets, apps can be modified until they are published (see Apps for more details).
Both apps and applets can request additional access privileges, such as network connections or project permissions. However, an executable's project permissions cannot exceed those of the user who runs it.
Input Specification
The input specification is an array of input parameter descriptors that define the inputs that the executable expects to run. The order of inputs in the array determines the rendering order on the DNAnexus website when users configure and launch the executable. If an input specification is not provided, then an applet can be run with any input, without validation for input argument names or types. An input parameter descriptor is a hash with the following key/value pairs:
namestring Name of the input. It must be unique across the inputs. Each input name must match the regular expression^[a-zA-Z_][0-9a-zA-Z_]*$(only letters and numbers, at least one char, does not start with a number).classstring The class of the input. This could be any data object class supported by the platform (such as "record", "file", or "applet"), in which case a link to an object ID must be provided for that input when the executable is run. Also to data object classes, the following value classes are supported:"int" represents a decimal integer. A JSON number must be given
"float" represents a decimal floating-point number. A JSON number must be given
"string" represents a string. A JSON (UTF-8) string must be given
"boolean" represents a boolean. The JSON value true or false must be given
"hash" represents an arbitrary JSON object
The input class name (other than "hash") can be preceded by the string "array:", for example, "array:file", to indicate that the input must be a nonempty JSON array of links to objects of the corresponding class.
optionalboolean (optional, default false) Whether this input is optionaldefaultinput class (optional) A value assigned to the input when omitted during executable runtime. This value also provides information about default values to users configuring and launching the executable through DNAnexus' website. If not provided, this input must be specified when launching the executable.Also to literal values, symbolic metadata references can be used as default values, for example:
{"inputSpec": [ {"name": "mappings_bam", "class": "file"}, {"name": "sample_id", "class": "string", "default": {"$dnanexus_link": {"input": "mappings_bam", "metadata": "properties.sample_id"}} } ]}
typestring or mapping (optional) A constraint on the type that the input object must be tagged with (this is valid only for inputs whose class is a data object class). If not provided, no type constraints apply. Can be provided in the following ways:A simple string to match a single type exactly, for example,
"Reads". This requires the input object to have the specified type.An AND condition requiring all specified types to match, for example,
{"$and": ["Reads", "PairedReads"]}. This requires the input object to have all the specified types.An OR condition requiring at least one specified type to match, for example,
{"$or": ["LetterReads", "ColorReads"]}. This requires the input object to have at least one of the specified types.Complex nested conditions. For example, to require that an object must be of type "Reads", and also have either "LetterReads" or "ColorReads" type:
{"$and": ["Reads", {"$or": ["LetterReads", "ColorReads"]}]}
patternsarray of strings or mapping (optional) If a list of strings is provided, it denotes name patterns for this input. This array is stored and returned verbatim by the API as part of the executable's description. Example:{"patterns": ["*.sam", "*.bam"]}. By convention, clients may use this array to filter objects displayed to the user as possible inputs for the executable and to infer compatibility between executable outputs and inputs, if no types are specified. If a mapping is provided, a broader set of filters for data objects can be specified and the interpretation of these key-value pairs is open to the client. For example, the client may use the following keys:name: array of strings (optional) the specification for this field is same as the array of strings described above.pointer_class: string (optional) Any data object class. This implies that the class of this input maps to a data object. A common example is when the class is 'string'. The display shows only data objects matching the specified class.tag: array of strings (optional) The display shows only data objects containing every tag in this array. This mapping indicates to the client that a data object must meet all criteria for display to the user. For example, consider this value for thepatternsfield:{ 'name': ['*.sam', '*.bam'], 'pointer_class': 'file', 'tag': ['foo', 'bar'] }This suggests to the client that only files with
.samor.bamextensions as well as both tagsfooandbarshould be displayed.
suggestionsarray of input class (optional) List of suggested possible values and/or, for data object inputs, an annotated hash providing a suggested value or a project/folder path containing possible inputs. For data object inputs, the input specification read via/applet-xxxx/describereturns an annotated hash. For example, a suggestion{"$dnanexus_link": "file-xxxx"}supplied to/applet/newappears in the applet description as{"value": {"$dnanexus_link": "file-xxxx"}}. An annotated hash has these key/value pairs:namestring (optional) Name for the suggestionvalueinput class (optional, required ifprojectis not provided) A suggested valueprojectstring (optional, required ifpathis provided and ifvalueis not) ID of the project containing suggested inputspathstring (optional, can only be present ifprojectis also present) Folder path insideprojectin which to suggest inputsregionstring (this field is not accepted when specifying an input specification to an API call, but it may be returned when making an API call that returns an input specification) Region of the specified project or data object. This field is set if and only if this is a data object input. Clients are advised to use this field to restrict the list of suggestions displayed to the user to only show values that are in the same region as the project in which the executable is being run. Below are some examples shown in an excerpt of an input specification:{ "inputSpec": [ { "name": "reference", "class": "file", "suggestions": [ { "name": "Reference Genomes", "project": "project-xxxx", "path": "/mm9/bwa" }, { "name": "Modest Mouse", "value": { "$dnanexus_link": { "project": "project-xxxx", "id": "file-xxxx" } } }, { "name": "Deadmau5", "value": { "$dnanexus_link": "file-xxxx" } }, { "$dnanexus_link": "file-xxxx" } ] } ] }For array inputs, each element in the
suggestionsarray should be a suggested value to be included in the array input. For input of class "array:int", the value ofsuggestionsshould therefore be an array of integers (and not an array of integer arrays).
choicesarray of input class (optional) List specifying the only possible values for the input field. The annotated syntax fromsuggestionscan annotate objects with names, but cannot include paths. Likesuggestions, thechoicesvalue must be an array of the enclosed class, not an array of arrays, when the input class is an array. At runtime, the system accepts only arrays containing elements from thechoicesarray.labelstring (optional) Human-readable label for the input field to use in place ofnamefor display purposesgroupstring (optional) Name of the settings group for this input field, used to organize fields under different UI tabs or sections. Without this value, the input parameter belongs to the first, default group. Groups appear in order of first occurrence in the input specification, with the unnamed group first.helpstring (optional) A longer description of the input field
Output Specification
The output specification is an array of output descriptors that describe the outputs that an executable produces. If an output specification is not given for an applet, it can produce any output without validation. An output descriptor is a hash supporting the same fields as the fields of an entry in the inputs array described earlier, except the following fields:
defaultsuggestionschoices
The specification of the patterns field is the same as the input. In the case the field is a mapping, this suggests to the client that the output field is a data object meeting the criteria described in the patterns field.
Run Specification
The run specification specifies how to run the executable and is a hash with the following key/values:
codestring: Source code of the executable (the script to execute).systemRequirementsmapping (optional): Request specific resources for each of the executable's stages.key: Entry point name of the executable, or "*" to indicate all entry points that are otherwise not present as keys. Use "main" for the initial entry point, or the function name run in /job/new for a subjob.
value mapping: Requested resources for the stage with key/values:
instanceTypestring (default "mem2_hdd2_x2"): A string specifying the instance type for setting up an Execution Environment to run your job. See Instance Types for a list of possible values.clusterSpecmapping (optional): Indicates that this job requires a cluster of instances rather than just a single worker node. This mapping should contain the following key/values:typestring: The type of cluster, supported values aredxspark,apachespark, andgenericversionstring (optional): Requested version fordxsparkorapachesparkclusters. Supported values are2.4.4, 3.2.3, 3.5.2initialInstanceCountinteger: The number of nodes (including the driver) in the cluster. Min value is 1 indicating a cluster with noclusterWorkernodes.portsstring (optional): A comma delimited string of ports or range of ports to open between nodes in the cluster. An example: "1000, 1100-1200" would open ports 1000 and all ports between 1100 & 1200.bootstrapScriptstring (optional): The path to the bootstrap script. The bootstrap script is run on all cluster nodes before the driver begins running the application code.
fpgaDriverstring (optional): Specifies the FPGA driver to install on the FPGA-enabled cloud host instance before app's code execution. Accepted values depend on instance type:mem3_ssd2_fpga1_x24, mem3_ssd2_fpga2_x48, mem3_ssd2_fpga8_x192:
edico-1.4.9.2(default),mem3_ssd2_fpga1_x8, mem3_ssd2_fpga1_x16, mem3_ssd2_fpga1_x64:
edico-1.4.2(default),edico-1.4.5, andedico-1.4.7.
nvidiaDriverstring (optional): Specifies the NVIDIA driver to install on the GPU-enabled cloud host instance before app's code execution. Accepted values are:R470(default) uses the driver version 470.256.02 and supports CUDA 11.4.R535uses the driver version 535.247.01 and supports CUDA 12.2.
executionPolicymapping (optional): A collection of options that govern automatic job restart on certain types of failures. This can only be set at overridden via the user-level/executable-xxxx/runAPI call (jobs cannot override this for their subjobs). Includes the following optional key/values:inheritParentRuntimeExecutionPolicyboolean (optional, false when undefined): when true, the parent job's runtimerestartOnvalue overrides the job.restartOnmapping: (optional): Indicates a job restart policykey: A restartable failure reason ("ExecutionError", "UnresponsiveWorker", "JMInternalError", "AppInternalError", "JobTimeoutExceeded", or "SpotInstanceInterruption") or "*" to indicate all restartable failure reasons that are otherwise not present as keys
value int: Maximum number of restarts for the failure reason
maxRestartsint (optional, default 9): Non-negative integer less than 10, indicating the maximum number of times to restart the job
timeoutPolicymapping (optional): User-specified default timeout policy, configurable by entry point, for jobs running this executable. If unspecified, jobs running this executable have no default timeout policy. The default timeout policy can be overridden at runtime. If present, includes at least one of the following key-value pairs:key: Entry point name or
"*"to indicate all entry points not explicitly specified intimeoutPolicy. If an entry point name is not explicitly specified and"*"is not present, a job running this executable at that entry point has no default timeout.value mapping: Default timeout for a job running this executable at the corresponding entry point. Includes at least one of the following key-value pairs:
key: Unit of time. One of "days", "hours", or "minutes".
value number: Amount of time for the corresponding time unit. Must be nonnegative. The effective default timeout is the sum of the units of time represented in this mapping. Setting the effective timeout to 0 is the same as specifying null for the corresponding executable at the corresponding entry point.
bundledDependsarray of mappings (optional): List of file objects (assets) placed in the execution environment before job execution. The system downloads files to "/" on the worker and unpacks compressed files (supporting at leasttar,gz, and other popular formats). These files must exist in the project containing the executable or be provided as input. Each element is a mapping with the following key/values:namestring: Name of the asset.idmapping: DNAnexus link to the asset, with key/value:$dnanexus_linkstring: ID of the file
stagesarray of strings: (optional, default all stages): List of the entry points of the executable for which the asset should be fetched. Use "main" for the initial entry point, or the function name run in /job/new for a subjob
distributionstring: The Linux operating system distribution to be used to run this executable's jobs. The only recognized value is "Ubuntu".releasestring: The Linux operating system release to be used to run this executable's jobs. Recognized values are24.04and20.04versionstring: The version of the application execution environment used to run this executable's jobs. A triplet of (distribution,release,version) uniquely identify an application execution environment. Recognized values ofversionare"0"for24.04and20.04releases
execDependsarray of mappings (optional): Specify package names and versions to be installed by the system package manager or a language-specific package manager in the execution environment before the executable is run. Each element has the key/values:namestring: Name of the package to be installed.package_managerstring (optional, defaultapt): The package manager used to install this package. Valid options areapt,pip3,pip,gem,cpan,cran, andgitversionstring (optional): Version of the package to be installed. Unsupported whenpackage_manageris "git"stagesarray of strings (optional, default all stages): List of the entry points of the executable for which the package should be installed. Use "main" for the initial entry point, or the function name run in /job/new for a subjob
restartableEntryPointsstring (optional, default "master"): Indicates which entry points of the executable are restartable when a restartable error occurs. See the entry forexecutionPolicy.restartOnabove for details on which errors are restartable. If a string, thenrestartableEntryPointsmust be one of "master" or "all". The value "master" indicates that only master job entry points are restartable, whereas "all" indicates that all entry points, including subjob entry points, are restartable. Ensure that all entry points of the executable are idempotent before specifying "all".headJobOnDemandboolean (optional, default null) If true, the system allocates master jobs from this executable to an on-demand instance, regardless of scheduling priority. All descendent jobs (if any) inherit the scheduling priority, with instance allocations independent of this option. Override through input toapp-xxxx/run,applet-xxxx/run, orjob/new.inheritParentRestartOnPolicyboolean (optional, defaults to false) When true, anapp-xxxx/neworapplet-xxxx/new jobfrom a parent job inherits its parent's selectedexcutionPolicy.restartOnvalue at runtime. When false, the job retains its policy from build time. Setting this to false does not prevent a parent execution (like an analysis) from overriding the job'srestartOnpolicy.
These fields are only returned in the responses of /app-xxxx[/yyyy]/describe and /applet-xxxx/describe. They should not be specified as input to /applet/new:
systemRequirementsByRegionmapping: Mapping that contains the specific resources requested for each of the executable's stages, by region. SeesystemRequirementsabove for more information regarding requesting resources for an executable's stages.key: Name of an enabled region of the executable. For applets, there should only be one key, because they are single-region.
value mapping: A mapping specifying the specific resources requested for each of the app's stages for when the app is run in the corresponding region. The syntax of this mapping is like that of
systemRequirementsabove.
bundledDependsByRegionmapping: Mapping that contains the bundled dependencies of the executable (app or applet) in each region in which the executable may be run. SeebundledDependsabove for more information regarding bundled dependencies.key: Name of the region in which this executable may be run, such as
aws:us-east-1. *value array of strings Array of bundled dependencies for the executable in the corresponding region.
Two run specifications are equivalent if and only if all their fields are equal, except for the following fields:
systemRequirementsByRegionsystemRequirementsbundledDependsByRegionbundledDepends
Access Requirements
Executables can request additional network access, or additional DNAnexus permissions in the form of project permissions or the ability to perform app development-related tasks on the behalf of the user. App development-related tasks include those of creating, modifying, and publishing apps, as well as adding and removing authorized developers for a particular app. To request additional access, provide a mapping with the following key/values:
networkarray of strings (optional): List of hostnames, hostname wildcards, network masks, and/or the string "*" (for unrestricted access) specifying which Internet hosts, domains, or subnets the executable can access. If omitted, the executable has no network access, except to the API server and selected other resources.projectstring (optional): A string from "VIEW", "UPLOAD", "CONTRIBUTE", and "ADMINISTER". The executable receives this permissions level in the project it was launched in, or the user's permissions level, whichever is lower. By default, applets but not apps have VIEW access to the project they are launched from.allProjectsstring (optional): A string from "VIEW", "UPLOAD", "CONTRIBUTE", and "ADMINISTER". The executable receives this permissions level in all projects the user has access to, or the user's permissions level, whichever is lower. If omitted, the executable has no extra permissions.developerboolean (optional): Whether the executable has permission to act with the same developer permissions as the user launching it.projectCreationboolean (optional): Whether the executable can create projects on behalf of the user. Jobs receive ADMINISTER access to projects they create, regardless of theallProjectsvalue. Within the same job tree, jobs get access to projects created by any ancestor jobs, but cannot access jobs created by their own descendant jobs.
Last updated
Was this helpful?