示例#1
0
def execute_no_pbs(t):
    global db
    if db is None:
        from db.mongo import Mongo
        db = Mongo()

    t.execute()
    result = collect_data.decorate_result(t.json_result)
    print(db.bench6.insert_one(result))
    return t
示例#2
0
def get_records(profileid, include):
    mongo = Mongo(profileid)
    report = ''
    report += mongo.get_accounts()
    report += mongo.get_entitlements()

    if include.atv or include.all:
        report += mongo.get_atv_subscriptions()

    if include.vodafone or include.all:
        report += mongo.get_vodafone_accounts()
    return report
示例#3
0
    def __init__(self, rabbitmq_ip, queue_name, db_ip, db_port, db_name,
                 collection_name):
        self.db = Mongo(db_ip, db_port, db_name)
        self.collection_name = collection_name

        self.connection = pika.BlockingConnection(
            pika.ConnectionParameters(host=rabbitmq_ip))
        self.channel = self.connection.channel()
        self.channel.queue_declare(queue=queue_name, durable=True)
        self.channel.basic_qos(prefetch_count=5)
        self.channel.basic_consume(self.callback, queue=queue_name)

        print ' [*] Waiting for messages. To exit press CTRL+C'
        self.channel.start_consuming()
示例#4
0
 def __init__(self, db, kw, start, end):
     # self.timer = datetime.datetime.now()
     self.mongo = Mongo(db=db)
     self.kwds  = Keywords(keywords=kw)
     self.lang  = LanguageKit(keywords=self.kwds)
     self.start = str(start)
     self.end   = str(end)
     self.docs  = [self.lang.FilterRetweets(t["text"]) for t in self.mongo.db["posts"].find(
                  {"lang":"en", 'timestamp':{"$gte": self.start, "$lt": self.end}}, {"text":1,"_id":0})]
     
     # Spamfilter, remove redundant
     self.docs = list(set(filter(None, self.docs)))
     self.docs = self.lang.FilterSpam(self.docs)
     self.docs = self.lang.SimpleSpamFilter(self.docs)
     
     self.multicore = Multicore()
     self.frequency = []
     self.scores    = []
     self.trace     = Config().out
     self.output    = Output(self.trace)
示例#5
0
def checkDBConnection():
    db = Mongo()
示例#6
0
 def setdb(self):
     from db.mongo import Mongo
     self.db = Mongo(db=self.dbname)
示例#7
0
# module list

export RESTRICTIONS={restriction_command}
WORKDIR=/tmp/bench-stat-{random_id}


mkdir -p $WORKDIR
cd $WORKDIR
{sys.executable} {collect_script} --test-id={test_id} --rep-id={rep_id} --commit={latest}
rm  -rf $WORKDIR

""".strip()

# repo = Repo(__root__)
# latest = repo.get_latest()
flowdb = FlowDB(Mongo())
latest = 'c4a410af274b9e6a6a5075214b2b5d38498e27ab'


# tests = 19
# repetitions = 15
tests = 1
repetitions = 50


indices = [(test_id, rep_id) for test_id in range(0, tests) for rep_id in range(0, repetitions)]
random.shuffle(indices)


def get_restrictions(commit, test):
    restrictions = list()
示例#8
0
文件: 01.py 项目: janhybs/bench-stat
#!/usr/bin/python
# -*- coding: utf-8 -*-
# author: Jan Hybs
from db.mongo import Mongo
import pandas as pd
import numpy as np
import seaborn as sns
sns.set(color_codes=True)
from matplotlib import pyplot as plt
from scipy.stats.stats import pearsonr

db = Mongo()
match = {'$match': {'node': 'janhybs'}}
cursor = db.bench.aggregate([
    match, {
        '$group': {
            '_id': {
                'node': '$node',
                'name': '$name'
            },
            'dur': {
                '$push': '$duration'
            },
            'eff': {
                '$push': '$time.eff'
            },
            'real': {
                '$push': '$time.real'
            },
            'user': {
                '$push': '$time.user'
示例#9
0
from flask import Flask
from flask import request
from db.mongo import Mongo
from worm.worm import Spider

from google.protobuf import json_format
import json

from proto.login_pb2 import LoginRsp
from proto.train_pb2 import *

mongo = Mongo()
app = Flask('ticket')
spider = Spider()


@app.route('/login', methods=['POST'])
def login():
    data = json.loads(request.data)
    print(data)
    rsp = LoginRsp()
    if verify_user(data):
        rsp.ok = True
    else:
        rsp.ok = False
        rsp.errno = 'Register failed'
    return rsp.SerializeToString()


def verify_user(data):
    res = mongo.find_user({'id': data['id']})
示例#10
0
 def __init__(self, rabbitmq_ip, queue_name, db_ip, db_port, db_name, collection_name):
     self.collection_name = collection_name
     self.db = Mongo(db_ip, db_port, db_name)
示例#11
0
class App():
    handlers = []
    updater = Updater()
    db = Mongo()
示例#12
0
from flask import Flask
from flask import render_template

from db.mongo import Mongo

app = Flask(__name__)
app.debug = True  #reload changes


@app.route('/')
def hello_world():
    return 'Hello World!'


@app.route('/devshop')
def devshop():
    collection = driver.getCollection('local', 'Clients')
    client = collection.find_one()
    name = client['_id']
    return render_template('hello.html', name=name)


if __name__ == '__main__':
    print("Initialize devshop")
    driver = Mongo()
    #print(driver)
    #driver.test()

    app.run(host='0.0.0.0')
    #app.run() #run only locally