13.1. actions Package

13.1.1. admin Module

The apps.actions.admin module contains the Django administration pages for the actions app

class apps.actions.admin.DeployEc2ProfileAdmin(model, admin_site)

The DeployEc2ProfileAdmin class represents the DeployEc2Profile model administration page

class apps.actions.admin.DistributedScriptAdmin(model, admin_site)

The DistributedScriptAdmin class represents the DistributedScript model administration page

class apps.actions.admin.EmailAdmin(model, admin_site)

The EmailAdmin class represents the Email model administration page

class apps.actions.admin.LocalScriptAdmin(model, admin_site)

The LocalScriptAdmin class represents the LocalScript model administration page

class apps.actions.admin.OSConfigurationAdmin(model, admin_site)

The OSConfigurationAdmin class represents the OSConfiguration model administration page

13.1.2. models Module

The apps.actions.models module contains the Django models for the actions app.

class apps.actions.models.Action(*args, **kwargs)

Bases: django.db.models.base.Model

The Action model represents an action that can be triggered. This model is never accessed on its own, it is always extended by other models that implements the specific actions.

name = None

Action name

timeout = None

Maximum number of seconds

triggers

Associated Triggers

class apps.actions.models.DeployEc2Node(*args, **kwargs)

Bases: apps.actions.models.Action

The DeployEc2Node represents the configuration needed to deploy a new Amazon EC2 Node..

ec2profile

The ec2profile associated with the new Node.

jvmprofiles

The jvmprofiles associated with the new Node.

sshprofile

The sshprofile associated with the new Node.

class apps.actions.models.DistributedScript(*args, **kwargs)

Bases: apps.actions.models.Action

The DistributedScript model represents a Fabric script to be executed localy in the PyScaler server and has got a specific destination such as a Node or a Cluster as target.

commandLine = None

Specifies additional parameters for Fabric’s fab utility.

fabfile = None

Fabric’s fabfile to be executed. It is execute using Fabric’s fab utility.

class apps.actions.models.Email(*args, **kwargs)

Bases: apps.actions.models.Action

The Email model represents an Action that sends an email to the specified address.

class apps.actions.models.LocalScript(*args, **kwargs)

Bases: apps.actions.models.Action

The LocalScript model represents a script to be executed localy in a specific destination such as a Node or a Cluster. It is usually a shell script.

class apps.actions.models.OSConfiguration(*args, **kwargs)

Bases: apps.actions.models.Action

The OSConfiguration model represents an Operating System configuration to be provisioned in a specific destination such as a Node or a Cluster. This is implemented with Puppet configuration files.

class apps.actions.models.TriggerAction(*args, **kwargs)

Bases: django.db.models.base.Model

The TriggerAction model represents a group of Action that must be executed in a specific order against a specific target.

TARGET = (('lastnode', 'LAST NODE'), ('cluster', 'CLUSTER'), ('none', 'NONE'))

Possible target types:

  • CLUSTER, the Cluster associated to the Trigger. Can be used by DeployEc2Node, OSConfiguration, LocalScript and DistributedScript actions.
  • LASTNODE, the last created Node of the Cluster associated to the Trigger. Can be used by OSConfiguration, LocalScript and DistributedScript actions.
  • NONE, no specified target. Can be used by Email action.
action

Associated Action.

target = None

Target type.

trigger

Associated Trigger.

13.1.3. tasks Module

The apps.actions.tasks module contains the Celery tasks for the actions app.

apps.actions.tasks.executeViaFabric(destination, script)
The executeViaFabric task executes LocalScripts or DistributedScripts or OSConfigurations using Fabric’s fab utility.
It can be used using both Nodes or Clusters as destinations
If the script is a LocalScript then fab will run the an operating system script locally on each destination
If the script is a DistributedScript then fab will run a Fabric’s fabfile locally on the PyScaler service but using the defined destination as target
If the script is an OSConfigurations then fab will run an existing fabfile called puppet.py, that will deploy the OSConfiguration in the destination target
apps.actions.tasks.ec2nodeDeploy(cluster, ec2profile, sshprofile, jvmprofiles)
The ec2nodeDeploy launches an ec2 instance using a Ec2Node as template and adds it to the specifed Cluster.
It needs AWSAccessKeyId and AWSSecretKey to be defined in Django’s settings.py
apps.actions.tasks.ec2nodeRemove(cluster, node)
The ec2nodeRemove task removes a Node and its associated ec2 instance.
It needs AWSAccessKeyId and AWSSecretKey to be defined in Django’s settings.py

13.1.4. urls Module

The apps.actions.urls module contains the Django urls definition for the actions app.

  • /actions/executescript/{{script}}/cluster/{{cluster}}/node/{{node}}

    Launches the executeViaFabricOnNode views function.

  • /actions/executescript/{{script}}/cluster/{{cluster}}/

    Launches the executeViaFabricOnNode views function.

  • /actions/executescript/output/{{taskid}}/

    Launches the executeViaFabricOutput views function.

  • /actions/ec2node/deploy/cluster/{{cluster}}/profile/{{ec2profile}}/sshprofile/{{sshprofile}}/jvmprofiles/{{jvmprofiles,jvmprofiles}}

    Launches the ec2nodeDeploy views function. jvmprofiles parameter can be repeated. Repetitions are split by commas.

  • /actions/ec2node/remove/cluster/{{cluster}}/node/{{node}}/

    Launches the ec2nodeRemove views function.

  • /actions/ec2node/output/{{taskid}}/

    Launches the ec2nodeOutput views function.

13.1.5. views Module

The apps.actions.views module contains the Django views definitions for the actions app.
These views handles the actions requests and their answers. All answers of these views are JSON and are meant to be used as an API.
apps.actions.views.ec2nodeDeploy(request, *args, **kwargs)
The ec2nodeDeploy function will launch an ec2 instance using a Ec2Profile, a SshProfile and many JvmProfiles and will add it to the specifed Cluster.
It needs AWSAccessKeyId and AWSSecretKey to be defined in Django’s settings.py
Its output is a JSON object containing the id of the Celery task that is executing deploying the EC2 Node.
apps.actions.views.ec2nodeOutput(request, *args, **kwargs)

The ec2nodeOutput function returns the status and output for the Celery task used to deploy or remove an Ec2 Node in JSON format.

apps.actions.views.ec2nodeRemove(request, *args, **kwargs)
This view function will remove a Node from PyScaler and terminate the ec2 instance.
It needs AWSAccessKeyId and AWSSecretKey to be defined in Django’s settings.py
apps.actions.views.executeViaFabricOnCluster(request, *args, **kwargs)
The executeViaFabricOnCluster function is used to execute a DistributedScript or LocalScript on a Cluster.
It uses the executeViaFabricTask function to execute the script.
apps.actions.views.executeViaFabricOnNode(request, *args, **kwargs)
The executeViaFabricOnNode function is used to execute a DistributedScript or LocalScript on a Node.
It uses the executeViaFabricTask function to execute the script.
apps.actions.views.executeViaFabricOutput(request, *args, **kwargs)

The executeViaFabricOutput function returns the status and output for the Celery task used to execute a DistributedScript or LocalScript in JSON format

apps.actions.views.executeViaFabricTask(destination, script)
The executeViaFabricTask function is executed by the executeOnNode and executeOnCluster function views to execute a DistributedScript or LocalScript on a specific destination.
Its output is a JSON object containing the id of the Celery task that is executing the script.

Project Versions

Table Of Contents

Previous topic

12.1. pyscaler Project

Next topic

13.2. control Package

This Page