This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_wtf import Form | |
from wtforms import FormField, FieldList, DecimalField | |
from flask import Flask, render_template | |
app = Flask(__name__) | |
app.secret_key = 'SHG' | |
class PairForm(Form): | |
first = DecimalField('First') | |
second = DecimalField('Second') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
from StringIO import StringIO | |
from datetime import timedelta | |
from rx import Observer | |
from rx.concurrency import TwistedScheduler | |
from rx.disposables import Disposable | |
from rx.subjects import Subject | |
from twisted.internet.protocol import Factory, Protocol, connectionDone | |
from twisted.internet.endpoints import TCP4ServerEndpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
es = Elasticsearch(hosts=['es-host:9200'], timeout=600) #long timeout for the restore operation | |
snapshotName='index_name_20151012140502' | |
alias = es.indices.get_alias('index_name').keys()[0] if es.indices.exists_alias(name='index_name') else '' | |
indices = filter(lambda x: x.startswith('index_name'), es.indices.get_aliases()) | |
indices.sort() | |
print 'restore repository' | |
es.snapshot.restore(repository='repository_name', snapshot=snapshotName, body ='{ "ignore_unavailable": "true", "include_global_state": false}', wait_for_completion=True) | |
if (len(alias) > 1): |