Implementation of simple algorithms
Simple algorithms can be implemented using a generic unix docker image, and totally defined in the json script.
Examples of this algorithms are parametric curl
or wget
operations on external APIs, shell for file processing, etc
Default ccpimage for simple algorithms
To implement methods that doesn’t need any particular library or configuration, we can insert bash
as ccpimage
. This instruction will select a basic Linux image.
{
"inputs": {
"ccpimage": {
"id": "ccpimage",
"title": "Runtime",
"description": "`bash`, a basic unix docker image.",
"minOccurs": 1,
"maxOccurs": 1,
"schema": {
"type": "string",
"format": "url",
"contentMediaType": "text/plain",
"default": "bash",
"readOnly": true
}
}
}
}
Execution Parameters
all the parameters and configurations needed for the execution of the algorithms are defined in the inputs section
{
"inputs": {
"baseurl": {
"id": "url",
"title": "API URL",
"description": "The URL of the REST API",
"minOccurs": 1,
"maxOccurs": 1,
"schema": {
"type": "string",
"format": "url",
"contentMediaType": "text/plain",
"default": "https://REST_API_URL/process/",
"readOnly": true
}
},
"file": {
"id": "file",
"title": "Input file",
"description": "The input file to be annotated",
"minOccurs": 1,
"maxOccurs": 1,
"schema": {
"type": "string",
"format": "file",
"contentMediaType": "text/plain",
"default": ""
}
}
}
}
the example use a input file , we will see in detail how to process it in input file
Execution
the implementation of the algorithms is totally defined in the deploy-script and in the execute-script
{
"additionalParameters": {
"parameters": [
{
"name": "deploy-script",
"value": [
"echo {{file}} | base64 -d > /ccp_data/input"
]
},
{
"name": "execute-script",
"value": [
"wget {{url}} --post-file /ccp_data/input -O /ccp_data/annotated.json"
]
}
]
}
}
example: bash example