Skip to content

Commit

Permalink
Merge PR #208: Add support for Compute Engine tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Dec 7, 2015
2 parents 95feeb9 + b3f1ba7 commit 791ea5c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 23 deletions.
7 changes: 5 additions & 2 deletions docs/config.template
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,12 @@ worker_groups=ipython_engine
# Values are specified in gigabytes.
# Default value is 10.
#
# tags: Comma-separated list of instance tags.
# Only supported when the cloud provider is `google`.
#
# scheduling: Define the type of instance scheduling.
# Only supported when the cloud provider is google.
# Only supported value is preemptible.
# Only supported when the cloud provider is `google`.
# Only supported value is `preemptible`.

# Some (working) examples:

Expand Down
25 changes: 15 additions & 10 deletions docs/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
.. include:: global.inc

=================
Configuration
Configuration
=================

All the information about how to access a cloud provider and how to
setup a cluster is stored in a configuration file. The default
configuration file is stored in your home directory:
configuration file is stored in your home directory:
``~/.elasticluster/config`` but you can specify a different location
from the command line with the `-c` option.

Expand Down Expand Up @@ -54,7 +54,7 @@ Basic syntax of the configuration file
======================================

The file is parsed by ConfigParser module and has a syntax similar
to Microsoft Windows INI files.
to Microsoft Windows INI files.

It consists of `sections` led by a ``[sectiontype/name]`` header and
followed by lines in the form::
Expand Down Expand Up @@ -122,7 +122,7 @@ section:
Valid configuration keys for `boto`
-----------------------------------

``ec2_url``
``ec2_url``

the url of the EC2 endpoint. For Amazon is probably
something like::
Expand Down Expand Up @@ -212,7 +212,7 @@ Valid configuration keys for *openstack*

``region_name``

OpenStack region (optional)
OpenStack region (optional)

``request_floating_ip``

Expand Down Expand Up @@ -245,7 +245,7 @@ For Amazon instead (region us-east-1) you can use::
[cloud/amazon-us-east-1]
provider=ec2_boto
ec2_url=https://ec2.us-east-1.amazonaws.com
ec2_access_key=****REPLACE WITH YOUR ACCESS ID****
ec2_access_key=****REPLACE WITH YOUR ACCESS ID****
ec2_secret_key=****REPLACE WITH YOUR SECRET KEY****
ec2_region=us-east-1
vpc=vpc-one
Expand All @@ -265,8 +265,8 @@ From the horizon web interface you can download a file containing your
EC2 credentials by logging into your provider web interface and
clicking on:

"*settings*"
=> "*EC2 Credentials*"
"*settings*"
=> "*EC2 Credentials*"
=> "*Download EC2 Credentials*"

The ``ec2rc.sh`` file will contain some values. Update the
Expand Down Expand Up @@ -295,7 +295,7 @@ Engine visit the following page:

Application type: Installed application
Installed application type: Other

7. Click the "Create Client ID" button
8. You'll see your Client ID and Client secret listed under
"Client ID for native application"
Expand Down Expand Up @@ -420,7 +420,7 @@ The following configuration keys are only valid if `provider` is

``slurm_clients``
compute nodes of a slurm cluster

``ganglia_master``
configure as ganglia web frontend. On the
master, you probably want to define `ganglia monitor` as well
Expand Down Expand Up @@ -604,11 +604,16 @@ Optional configuration keys
Values are specified in gigabytes.
Default value is 10.

``tags``
Comma-separated list of instance tags.
Only supported when the cloud provider is `google`.

``scheduling``
Define the type of instance scheduling.
Only supported when the cloud provider is `google`.
Only supported value is `preemptible`.


Examples
--------

Expand Down
22 changes: 13 additions & 9 deletions docs/html/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Configuration &mdash; elasticluster 1.0 documentation</title>

<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
Expand All @@ -25,7 +25,7 @@
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="elasticluster 1.0 documentation" href="index.html" />
<link rel="next" title="Usage" href="usage.html" />
<link rel="prev" title="Installation" href="install.html" />
<link rel="prev" title="Installation" href="install.html" />
</head>
<body>
<div class="related">
Expand All @@ -43,15 +43,15 @@ <h3>Navigation</h3>
<li class="right" >
<a href="install.html" title="Installation"
accesskey="P">previous</a> |</li>
<li><a href="index.html">elasticluster 1.0 documentation</a> &raquo;</li>
<li><a href="index.html">elasticluster 1.0 documentation</a> &raquo;</li>
</ul>
</div>
</div>

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">

<div class="section" id="configuration">
<h1>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h1>
<p>All the information about how to access a cloud provider and how to
Expand Down Expand Up @@ -555,7 +555,7 @@ <h3>Optional configuration keys<a class="headerlink" href="#optional-configurati
<blockquote>
<div>Define the type of boot disk to use.
Only supported when the cloud provider is <cite>google</cite>.
Supported values are <em>pd-standard</em> and <em>pd-ssd</em>.
Supported values are <em>pd-standard</em> and <em>pd-ssd</em>.
Default value is <em>pd-standard</em>.
</div></blockquote>
<p><tt class="docutils literal"><span class="pre">boot_disk_size</span></tt></p>
Expand All @@ -564,6 +564,10 @@ <h3>Optional configuration keys<a class="headerlink" href="#optional-configurati
Only supported when the cloud provider is <cite>google</cite>.
Value is specified in gigabytes. Default value is 10.
</div></blockquote>
<p><tt class="docutils literal"><span class="pre">tags</span></tt></p>
<blockquote>
<div>Comma-separated list of instance tags.
Only supported when the cloud provider is <cite>google</cite>.
<p><tt class="docutils literal"><span class="pre">scheduling</span></tt></p>
<blockquote>
<div>Define the type of instance scheduling.
Expand Down Expand Up @@ -741,7 +745,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="install.html" title="Installation"
>previous</a> |</li>
<li><a href="index.html">elasticluster 1.0 documentation</a> &raquo;</li>
<li><a href="index.html">elasticluster 1.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
2 changes: 1 addition & 1 deletion elasticluster/cluster.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python
#
# Copyright (C) 2013 S3IT, University of Zurich
# Copyright (C) 2013, 2015 S3IT, University of Zurich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
9 changes: 8 additions & 1 deletion elasticluster/providers/gce.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2013 S3IT, University of Zurich
# Copyright (C) 2013, 2015 S3IT, University of Zurich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -215,6 +215,7 @@ def start_instance(self,
instance_name=None,
boot_disk_type='pd-standard',
boot_disk_size=10,
tags=None,
scheduling=None,
**kwargs):
"""Starts a new instance with the given properties and returns
Expand All @@ -231,6 +232,9 @@ def start_instance(self,
:param str username: username for the given ssh key, default None
:param str instance_name: name of the instance
:param str tags: comma-separated list of "tags" to label the instance
:param str scheduling: scheduling option to use for the instance ("preemptible")
:param str scheduling: scheduling option to use for the instance ("preemptible")
Expand Down Expand Up @@ -290,6 +294,9 @@ def start_instance(self,
instance = {
'name': instance_name,
'machineType': machine_type_url,
'tags': {
'items': tags.split(',') if tags else None
},
'scheduling': scheduling_option,
'disks': [{
'autoDelete': 'true',
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def ansible_pb_files():
'boto',
# OpenStack clouds
'python-novaclient',
'pbr',
# GCE cloud
'google-api-python-client',
'python-gflags',
Expand Down

0 comments on commit 791ea5c

Please sign in to comment.