Commit 9797623d authored by Laurent Ganne's avatar Laurent Ganne
Browse files

Added an example of application template

parent e0c32091
# lexis-tosca-samples
Example of application template that can be zipped and uploaded to an Alien4Cloud
catalog.
This example requires the user to provide in input a zip of his dataset.
This dataset will be provided in input of a job that will be submitted using HEAppE.
Once the job is done, a Virtual Machine will be created, docker will be installed on it,
job results will be copied on this Virtual Machine, and an Apache httpd docker container
will be started.
A graphical view of the application template shows:
![App template](images/apptemplate.png)
This application template is providing an `install` workflow that will:
* create a HEAppE job (component TestJob above)
* allocate a floating IP address on an OpenStack location
This workflow is automatically executed at application deployment time.
The application template is also providing a `run` workflow executed on user demand,
that will:
* copy the dataset to the HEAppe Job inputs directory on the IT4I HPC cluster (component Dataset above)
* submit the HEAppE job (component TestJob above) created on IT4I cluster
* wait for its end
* get job results (component Results above)
* create a Virtual Machine on OpenStack in LRZ (component VirtualMachine)
* install and start Docker on this Virtual Machine (component Docker hosted on the VirtualMachine)
* copy job results on this Virtual Machine (component CopyResults hosted on the VirtualMachine)
* start an Apache httpd container (Component Apache hosted o the Component Docker)
A graphical view of this workflow shows:
![Run workflow](images/runworkflow.png)
tosca_definitions_version: alien_dsl_2_0_0
metadata:
template_name: HEAppETest
template_version: 0.1.0-SNAPSHOT
template_author: lexis
description: ""
imports:
- yorc-types:1.1.0
- tosca-normative-types:1.0.0-ALIEN20
- docker-types:2.2.0-SM9
- alien-base-types:2.2.0-SM9
- heappe-types:0.1.0
- org.ystia.docker.containers.docker.generic:2.2.0-SNAPSHOT
- org.ystia.docker.ansible:2.2.0-SNAPSHOT
topology_template:
input_artifacts:
zip_dataset:
type: tosca.artifacts.File
node_templates:
TestJob:
type: org.heappe.nodes.Job
properties:
jobSpecification:
name: testJobName
project: testProjectName
clusterNodeTypeId: 1
priority: 4
minCores: 1
maxCores: 1
waitingLimit: 600
walltimeLimit: 600
tasks:
- name: testTaskName
commandTemplateId: 1
templateParameterValues:
- commandParameterIdentifier: inputParam
parameterValue: inputParam
minCores: 1
maxCores: 1
walltimeLimit: 600
standardOutputFile: "console_Stdout"
standardErrorFile: "console_Stderr"
progressFile: "console_Stdprog"
logFile: "console_Stdlog"
Dataset:
type: org.heappe.nodes.Dataset
artifacts:
zip_dataset:
file: { get_input_artifact: zip_dataset }
type: tosca.artifacts.File
requirements:
- dependsOnHeappejob:
type_requirement: job
node: TestJob
capability: org.heappe.capabilities.HeappeJob
relationship: org.heappe.relationships.SendInputsToJob
Results:
type: org.heappe.nodes.Results
requirements:
- dependsOnHeappejob:
type_requirement: job
node: TestJob
capability: org.heappe.capabilities.HeappeJob
relationship: org.heappe.relationships.GetResultsFromJob
PublicNet:
type: tosca.nodes.Network
properties:
ip_version: 4
VirtualMachine:
type: tosca.nodes.Compute
requirements:
- networkPublicNetConnection:
type_requirement: network
node: PublicNet
capability: tosca.capabilities.Connectivity
relationship: tosca.relationships.Network
capabilities:
scalable:
properties:
min_instances: 1
max_instances: 1
default_instances: 1
endpoint:
properties:
secure: true
protocol: tcp
network_name: PRIVATE
initiator: source
CopyResults:
type: org.heappe.nodes.CopyResults
properties:
destination_dir: /home/centos/
requirements:
- hostedOnVirtualMachineHost:
type_requirement: host
node: VirtualMachine
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
- dependsOnJobResults:
type_requirement: job_results
node: Results
capability: org.heappe.capabilities.HeappeJobResults
relationship: org.heappe.relationships.CopyResults
Docker:
type: org.ystia.docker.ansible.nodes.Docker
properties:
docker_version: ""
requirements:
- hostedOnVirtualMachineHost:
type_requirement: host
node: VirtualMachine
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
Apache:
type: org.ystia.docker.containers.docker.generic.nodes.GenericContainer
properties:
auto_remove: false
cleanup: false
detach: true
image: "httpd:latest"
keep_volumes: true
published_ports:
- "8080:80"
restart_policy: no
cpu_share: 1.0
mem_share: "128 MB"
docker_bash_cmd:
- "/bin/bash"
- "-c"
requirements:
- hostedOnContainerRuntimeDockerHost:
type_requirement: host
node: Docker
capability: org.alien4cloud.extended.container.capabilities.ApplicationHost
relationship: org.alien4cloud.extended.container.relationships.HostedOnContainerRuntime
capabilities:
scalable:
properties:
min_instances: 1
max_instances: 1
default_instances: 1
workflows:
install:
steps:
TestJob_create:
target: TestJob
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.create
on_success:
- TestJob_started
TestJob_started:
target: TestJob
activities:
- set_state: started
on_success:
- Dataset_create
- Results_create
Dataset_create:
target: Dataset
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.create
on_success:
- Dataset_started
Dataset_started:
target: Dataset
activities:
- set_state: started
Results_create:
target: Results
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.create
on_success:
- Results_started
Results_started:
target: Results
activities:
- set_state: started
Network_install:
target: PublicNet
activities:
- delegate: install
uninstall:
steps:
GenericContainer_stop:
target: Apache
activities:
- call_operation: Standard.stop
on_success:
- GenericContainer_delete
GenericContainer_delete:
target: Apache
activities:
- call_operation: Standard.delete
on_success:
- GenericContainer_deleted
GenericContainer_deleted:
target: Apache
activities:
- set_state: deleted
on_success:
- Docker_stop
Docker_stop:
target: Docker
activities:
- call_operation: Standard.stop
on_success:
- Docker_deleted
Docker_deleted:
target: Docker
activities:
- set_state: deleted
on_success:
- Compute_uninstall
Compute_uninstall:
target: VirtualMachine
activities:
- delegate: uninstall
on_success:
- Network_uninstall
Network_uninstall:
target: PublicNet
activities:
- delegate: uninstall
on_success:
- Results_delete
Results_delete:
target: Results
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.delete
on_success:
- Results_deleted
Results_deleted:
target: Results
activities:
- set_state: deleted
on_success:
- Dataset_delete
Dataset_delete:
target: Dataset
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.delete
on_success:
- Dataset_deleted
Dataset_deleted:
target: Dataset
activities:
- set_state: started
on_success:
- TestJob_delete
TestJob_delete:
target: TestJob
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.delete
on_success:
- TestJob_deleted
TestJob_deleted:
target: TestJob
activities:
- set_state: deleted
start:
steps:
Job_start:
target: TestJob
activities:
- set_state: started
on_success:
- Dataset_start
Dataset_start:
target: Dataset
activities:
- set_state: started
stop:
steps:
Job_stop:
target: TestJob
activities:
- set_state: stopped
Dataset_stop:
target: Dataset
activities:
- set_state: stopped
on_success:
- Job_stop
run:
steps:
Dataset_send_inputs:
target: Dataset
operation_host: ORCHESTRATOR
activities:
- call_operation: Custom.sendJobInputs
on_success:
- TestJob_submit
TestJob_submit:
target: TestJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.submit
on_success:
- Job_submitted
Job_submitted:
target: TestJob
activities:
- set_state: submitted
on_success:
- TestJob_run
TestJob_run:
target: TestJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.run
on_success:
- Job_executed
Job_executed:
target: TestJob
activities:
- set_state: executed
on_success:
- Results_get
Results_get:
target: Results
operation_host: ORCHESTRATOR
activities:
- call_operation: Custom.getResults
on_success:
- Compute_install
Compute_install:
target: VirtualMachine
activities:
- delegate: install
on_success:
- Docker_create
Docker_create:
target: Docker
activities:
- call_operation: Standard.create
on_success:
- Docker_configure
Docker_configure:
target: Docker
activities:
- call_operation: Standard.configure
on_success:
- Docker_start
Docker_start:
target: Docker
activities:
- call_operation: Standard.start
on_success:
- Docker_started
Docker_started:
target: Docker
activities:
- set_state: started
on_success:
- GenericContainer_create
- CopyResults_copy
GenericContainer_create:
target: Apache
activities:
- call_operation: Standard.create
on_success:
- GenericContainer_start
CopyResults_copy:
target: CopyResults
activities:
- call_operation: Custom.copyResults
on_success:
- CopyResults_executed
CopyResults_executed:
target: CopyResults
activities:
- set_state: executed
on_success:
- GenericContainer_start
GenericContainer_start:
target: Apache
activities:
- call_operation: Standard.start
on_success:
- GenericContainer_started
GenericContainer_started:
target: Apache
activities:
- set_state: started
cancel:
steps:
Job_cancel:
target: TestJob
activities:
- set_state: cancelled
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment