예제 #1
0
from os.path import join

import utils
from models.bots import CypherAssistantBot

env_filepath = join(".", "conf.env")

if __name__ == "__main__":
    env_vars = utils.read_env(filepath=env_filepath)
    bot = CypherAssistantBot(token=env_vars["TELEGRAM_BOT_TOKEN"])
    del env_vars
예제 #2
0
from flask_wtf.csrf import CSRFProtect, CSRFError

from sqlalchemy import desc

import tweepy

import click
import pytest

from models import db, Biorxiv, Test
from biorxiv_scraper import find_authors, find_date, count_pages
from detect_cmap import detect_rainbow_from_iiif
import utils

# Reads env file into environment, if found
_ = utils.read_env()

app = flask.Flask(__name__)
app.config['BASE_URL'] = os.environ['BASE_URL']

# For data storage
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db.init_app(app)

# For job handling
app.config['RQ_REDIS_URL'] = os.environ['RQ_REDIS_URL']
rq = RQ(app)

# For monitoring papers (until Biorxiv provides a real API)
app.config['TWITTER_APP_KEY'] = os.environ['TWITTER_APP_KEY']
import json
import os
import os.path
from datetime import datetime

from artifactor.plugins.post_result import test_report
from utils import read_env
from utils.path import project_path
from utils.trackerbot import post_jenkins_result

job_name = os.environ['JOB_NAME']
number = int(os.environ['BUILD_NUMBER'])
date = str(datetime.now())

# reduce returns to bools for easy logic
runner_src = read_env(project_path.join('.jenkins_runner_result'))
runner_return = runner_src.get('RUNNER_RETURN', '1') == '0'
test_return = runner_src.get('TEST_RETURN', '1') == '0'

# 'stream' environ is set by jenkins for all stream test jobs
# but not in the template tester
if job_name not in ('template-tester', 'template-tester-openstack',
                    'template-tester-rhevm', 'template-tester-virtualcenter'):
    # try to pull out the appliance template name
    template_src = read_env(project_path.join('.appliance_template'))
    template = template_src.get('appliance_template', 'Unknown')
    stream = os.environ['stream']
else:
    tester_src = read_env(project_path.join('.template_tester'))
    stream = tester_src['stream']
    template = tester_src['appliance_template']
예제 #4
0
import json
import os
import os.path
from datetime import datetime

from artifactor.plugins.post_result import test_report
from utils import read_env
from utils.path import project_path
from utils.trackerbot import post_jenkins_result

job_name = os.environ['JOB_NAME']
number = int(os.environ['BUILD_NUMBER'])
date = str(datetime.now())

# reduce returns to bools for easy logic
runner_src = read_env(project_path.join('.jenkins_runner_result'))
runner_return = runner_src.get('RUNNER_RETURN', '1') == '0'
test_return = runner_src.get('TEST_RETURN', '1') == '0'


# 'stream' environ is set by jenkins for all stream test jobs
# but not in the template tester
if job_name not in ('template-tester', 'template-tester-openstack',
                    'template-tester-rhevm', 'template-tester-virtualcenter'):
    # try to pull out the appliance template name
    template_src = read_env(project_path.join('.appliance_template'))
    template = template_src.get('appliance_template', 'Unknown')
    stream = os.environ['stream']
else:
    tester_src = read_env(project_path.join('.template_tester'))
    stream = tester_src['stream']
예제 #5
0
import json
import os
import os.path
from datetime import datetime

from artifactor.plugins.post_result import test_report
from utils import read_env
from utils.path import project_path
from utils.trackerbot import post_jenkins_result

job_name = os.environ["JOB_NAME"]
number = int(os.environ["BUILD_NUMBER"])
date = str(datetime.now())

# reduce returns to bools for easy logic
runner_src = read_env(project_path.join(".jenkins_runner_result"))
runner_return = runner_src.get("RUNNER_RETURN", "1") == "0"
test_return = runner_src.get("TEST_RETURN", "1") == "0"


# 'stream' environ is set by jenkins for all stream test jobs
# but not in the template tester
if job_name not in (
    "template-tester",
    "template-tester-openstack",
    "template-tester-rhevm",
    "template-tester-virtualcenter",
):
    # try to pull out the appliance template name
    template_src = read_env(project_path.join(".appliance_template"))
    template = template_src.get("appliance_template", "Unknown")