Example: Simple batch application¶
Frequency of use | Common |
---|---|
Actors |
|
Communication Flow: Kotlin
/* Applications contain quite a lot of information. The most important pieces of information are
summarized below:
- This Job will run a `BATCH` application
- See `invocation.applicationType`
- The application should launch the `acme/batch:1.0.0` container
- `invocation.tool.tool.description.backend`
- `invocation.tool.tool.description.image`
- The command-line invocation will look like this: `acme-batch --debug "Hello, World!"`.
- The invocation is created from `invocation.invocation`
- With parameters defined in `invocation.parameters` */
AppStore.findByNameAndVersion.call(
FindByNameAndVersionRequest(
appName = "acme-batch",
appVersion = "1.0.0",
),
user
).orThrow()
/*
ApplicationWithFavoriteAndTags(
favorite = false,
invocation = ApplicationInvocationDescription(
allowAdditionalMounts = null,
allowAdditionalPeers = null,
allowMultiNode = false,
allowPublicIp = false,
allowPublicLink = null,
applicationType = ApplicationType.BATCH,
container = null,
environment = null,
fileExtensions = emptyList(),
invocation = listOf(WordInvocationParameter(
word = "acme-batch",
), VariableInvocationParameter(
isPrefixVariablePartOfArg = false,
isSuffixVariablePartOfArg = false,
prefixGlobal = "--debug ",
prefixVariable = "",
suffixGlobal = "",
suffixVariable = "",
variableNames = listOf("debug"),
), VariableInvocationParameter(
isPrefixVariablePartOfArg = false,
isSuffixVariablePartOfArg = false,
prefixGlobal = "",
prefixVariable = "",
suffixGlobal = "",
suffixVariable = "",
variableNames = listOf("value"),
)),
licenseServers = emptyList(),
modules = null,
outputFileGlobs = listOf("*"),
parameters = listOf(ApplicationParameter.Bool(
defaultValue = null,
description = "Should debug be enabled?",
falseValue = "false",
name = "debug",
optional = false,
title = "",
trueValue = "true",
), ApplicationParameter.Text(
defaultValue = null,
description = "The value for the batch application",
name = "value",
optional = false,
title = "",
)),
shouldAllowAdditionalMounts = false,
shouldAllowAdditionalPeers = true,
ssh = null,
tool = ToolReference(
name = "acme-batch",
tool = Tool(
createdAt = 1633329776235,
description = NormalizedToolDescription(
authors = listOf("UCloud"),
backend = ToolBackend.DOCKER,
container = null,
defaultNumberOfNodes = 1,
defaultTimeAllocation = SimpleDuration(
hours = 1,
minutes = 0,
seconds = 0,
),
description = "An example tool",
image = "acme/batch:1.0.0",
info = NameAndVersion(
name = "acme-batch",
version = "1.0.0",
),
license = "None",
requiredModules = emptyList(),
supportedProviders = null,
title = "Acme batch",
),
modifiedAt = 1633329776235,
owner = "_ucloud",
),
version = "1.0.0",
),
vnc = null,
web = null,
),
metadata = ApplicationMetadata(
authors = listOf("UCloud"),
createdAt = 1717663228341,
description = "An example application",
flavorName = null,
group = ApplicationGroup(
metadata = ApplicationGroup.Metadata(
id = 0,
),
specification = ApplicationGroup.Specification(
categories = emptySet(),
colorReplacement = ApplicationGroup.ColorReplacements(
dark = null,
light = null,
),
defaultFlavor = null,
description = "",
logoHasText = false,
title = "Test Group",
),
status = ApplicationGroup.Status(
applications = null,
),
),
isPublic = true,
name = "acme-batch",
public = true,
title = "Acme batch",
version = "1.0.0",
website = null,
),
tags = emptyList(),
)
*/
Communication Flow: Curl
# ------------------------------------------------------------------------------------------------------
# $host is the UCloud instance to contact. Example: 'http://localhost:8080' or 'https://cloud.sdu.dk'
# $accessToken is a valid access-token issued by UCloud
# ------------------------------------------------------------------------------------------------------
# Applications contain quite a lot of information. The most important pieces of information are
# summarized below:
#
# - This Job will run a `BATCH` application
# - See `invocation.applicationType`
#
# - The application should launch the `acme/batch:1.0.0` container
# - `invocation.tool.tool.description.backend`
# - `invocation.tool.tool.description.image`
#
# - The command-line invocation will look like this: `acme-batch --debug "Hello, World!"`.
# - The invocation is created from `invocation.invocation`
# - With parameters defined in `invocation.parameters`
# Authenticated as user
curl -XGET -H "Authorization: Bearer $accessToken" "$host/api/hpc/apps/byNameAndVersion?appName=acme-batch&appVersion=1.0.0"
# {
# "metadata": {
# "name": "acme-batch",
# "version": "1.0.0",
# "authors": [
# "UCloud"
# ],
# "title": "Acme batch",
# "description": "An example application",
# "website": null,
# "public": true,
# "flavorName": null,
# "group": {
# "metadata": {
# "id": 0
# },
# "specification": {
# "title": "Test Group",
# "description": "",
# "defaultFlavor": null,
# "categories": [
# ],
# "colorReplacement": {
# "light": null,
# "dark": null
# },
# "logoHasText": false
# },
# "status": {
# "applications": null
# }
# },
# "createdAt": 1717663228341
# },
# "invocation": {
# "tool": {
# "name": "acme-batch",
# "version": "1.0.0",
# "tool": {
# "owner": "_ucloud",
# "createdAt": 1633329776235,
# "modifiedAt": 1633329776235,
# "description": {
# "info": {
# "name": "acme-batch",
# "version": "1.0.0"
# },
# "container": null,
# "defaultNumberOfNodes": 1,
# "defaultTimeAllocation": {
# "hours": 1,
# "minutes": 0,
# "seconds": 0
# },
# "requiredModules": [
# ],
# "authors": [
# "UCloud"
# ],
# "title": "Acme batch",
# "description": "An example tool",
# "backend": "DOCKER",
# "license": "None",
# "image": "acme/batch:1.0.0",
# "supportedProviders": null
# }
# }
# },
# "invocation": [
# {
# "type": "word",
# "word": "acme-batch"
# },
# {
# "type": "var",
# "variableNames": [
# "debug"
# ],
# "prefixGlobal": "--debug ",
# "suffixGlobal": "",
# "prefixVariable": "",
# "suffixVariable": "",
# "isPrefixVariablePartOfArg": false,
# "isSuffixVariablePartOfArg": false
# },
# {
# "type": "var",
# "variableNames": [
# "value"
# ],
# "prefixGlobal": "",
# "suffixGlobal": "",
# "prefixVariable": "",
# "suffixVariable": "",
# "isPrefixVariablePartOfArg": false,
# "isSuffixVariablePartOfArg": false
# }
# ],
# "parameters": [
# {
# "type": "boolean",
# "name": "debug",
# "optional": false,
# "defaultValue": null,
# "title": "",
# "description": "Should debug be enabled?",
# "trueValue": "true",
# "falseValue": "false"
# },
# {
# "type": "text",
# "name": "value",
# "optional": false,
# "defaultValue": null,
# "title": "",
# "description": "The value for the batch application"
# }
# ],
# "outputFileGlobs": [
# "*"
# ],
# "applicationType": "BATCH",
# "vnc": null,
# "web": null,
# "ssh": null,
# "container": null,
# "environment": null,
# "allowAdditionalMounts": null,
# "allowAdditionalPeers": null,
# "allowMultiNode": false,
# "allowPublicIp": false,
# "allowPublicLink": null,
# "fileExtensions": [
# ],
# "licenseServers": [
# ],
# "modules": null
# },
# "favorite": false,
# "tags": [
# ]
# }