Skip to content

Commit

Permalink
docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
iiman committed May 9, 2016
1 parent 24bf17b commit 2824ab4
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 6 deletions.
3 changes: 0 additions & 3 deletions docs/developer_manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ Developer Manual
================

.. toctree::


Smart Connectors <smartconnector>
sc_create
parametersweep
payload
chimineyui
Expand Down
4 changes: 2 additions & 2 deletions docs/quick_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ to a provided output location. The unix machine must have ssh service enabled.
Requirements
------------

#. :ref:`Install and configure <installation_guide>` the Chiminey platform.
#. :ref:`Install and configure <installation_guide>` a Chiminey platform.
#. Register an :ref:`HPC compute resource <hpc_resource>`. For this example, the HPC resource could be any unix server where ssh service is enabled,
including the Chiminey deployment itself.
#. Register a storage resource, specifically a :ref:`remote file system <remote_storage>`. Similar to the compute resource, the Chiminey deployment can be used a storage resource.
#. Register a storage resource, specifically a :ref:`remote file system <remote_storage>`. Similar to the compute resource, the Chiminey deployment can be used a storage resource.


Creating the Unix Random Number Smart Connector
Expand Down
3 changes: 2 additions & 1 deletion docs/sc_create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Each tasks are discussed below by creating an example smart connector. This sm

- Login to the chiminey docker container::

$ cd docker-chiminey
$ ./chimineyterm


Expand Down Expand Up @@ -90,7 +91,7 @@ The details include a unique name (with no spaces), a python path to ``RandNumIn
"description": "Randnum generator, with timestamp",
"payload": "/opt/chiminey/current/payload_randnum"
},


Finally, restart the Chiminey platform and then activate ``randnum`` smart connector. You need to exit the docker container and execute the following::

Expand Down
108 changes: 108 additions & 0 deletions docs/smartconnector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,111 @@ Following are the predefined stages that make up a smart connector (the predefin

- **destroy:**
Terminates previously created virtual machines.



Creating a smart connector
"""""""""""""""""""""""""""

Creating a smart connector involves completing three tasks:

#. providing :ref:`the core functionality <sc_core_fcn>` of the smart connector,
#. attaching :ref:`resources and optional non-functional properties <sc_attach_resources>`, and
#. :ref:`registering <sc_registration>` the new smart connector with the Chiminey platform.


Each tasks are discussed below by creating an example smart connector. This smart connector generates a random number with a timestamp, and then writes the output to a file.


**NB**: Login to the Chiminey docker container.

- For Mac OS X and Windows users, open `Docker Quickstart Terminal`. For linux-based OS users, login to your machine and open a terminal.

- Login to the chiminey docker container::

$ cd docker-chiminey
$ ./chimineyterm



.. _sc_core_fcn:

The Core Function
~~~~~~~~~~~~~~~~~

The core functionality of a smart connector is provided either via a :ref:`payload <payload>` or by overriding the ``run_task`` method of ``chiminey.corestages.execute.Execute`` class.
In this example, we use a minimal payload to provide the core functionality of this smart connector. Thus, we will prepare the following payload.

::

payload_randnum/
|--- process_payload
│   |--- main.sh


Below is the content of main.sh::

#!/bin/sh
OUTPUT_DIR=$1
echo $RANDOM > $OUTPUT_DIR/signed_randnum date > $OUTPUT_DIR/signed_randnum
# --- EOF ---


Notice ``OUTPUT_DIR``. This is the path to the output directory, and thus Chiminey expects all outputs to be redirected to that location.
The contents of ``OUTPUT_DIR`` will be transferred to the output location at the end of each computation.


.. _sc_attach_resources:

Attaching resources and non-functional properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Resources and non-functional properties are attached to a smart connector by overriding ``get_ui_schema_namespace`` method of ``chiminey.initialisation.coreinitial.CoreInitial`` class.
New domain-specific variables can be introduced via ``get_domain_specific_schemas`` method. In this example, we will need to attached a unix compute resource for the computation, and
a storage resource for the output location. However, we will not add a non-functional property.

Under chiminey/, we create a python package `randnum`, and add ``initialise.py`` with the following content

::

from chiminey.initialisation import CoreInitial from django.conf import settings
class RandNumInitial(CoreInitial):
def get_ui_schema_namespace(self):
schemas = [
settings.INPUT_FIELDS[’unix’],
settings.INPUT_FIELDS[’output_location’],
] return schemas
# ---EOF ---



.. _sc_registration:

Registration
~~~~~~~~~~~~~

The final step is registering the smart connector with the Chiminey platform. The details of this smart connector will be added to the dictionary ``SMART CONNECTORS`` in ``chiminey/settings changeme.py``.
The details include a unique name (with no spaces), a python path to ``RandNumInitial`` class, the description of the smart connector, and the absolute path to the payload.

::

"randnum": {
"name": "randnum",
"init": "chiminey.randnum.initialise.RandNumInitial",
"description": "Randnum generator, with timestamp",
"payload": "/opt/chiminey/current/payload_randnum"
},


Finally, restart the Chiminey platform and then activate ``randnum`` smart connector. You need to exit the docker container and execute the following::

$ sh restart
$ ./activatesc randnum


The list
of available resources and non-functional properties is given by ``INPUT_FIELDS`` parameter in ``chiminey/settings_changeme.py``



:ref:`Various examples <examples>` are given to show how a smart connector is created.

0 comments on commit 2824ab4

Please sign in to comment.