Beispiel #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to stop the configured redis instance
"""

from modelrunner import config
from modelrunner.settings import (initialize, redis_connection)

# setup config options
from tornado.options import parse_command_line, parse_config_file

# so we can load config via cmd line args
parse_command_line()
parse_config_file(config.options.config_file)

# initialize the global application settings
initialize(config.options.redis_url)

# stop redis
redis_connection().shutdown()
import modelrunner
from modelrunner.settings import initialize
from modelrunner import (
    config,
    Job,
    PrimaryServer
)

# setup config options
from tornado.options import parse_command_line, parse_config_file

# so we can load config via cmd line args
parse_command_line()
parse_config_file(config.options.config_file)

# initialize the global application settings
initialize(config.options.redis_url)

primary_server = PrimaryServer(
                    config.options.primary_url,
                    config.options.data_dir)

job = modelrunner.Job(config.options.model)
Job[job.uuid] = job
input_fh = open(config.options.input_file, 'r')
primary_server.enqueue(job, input_fh.read())
input_fh.close()

print("created job {}".format(job.uuid))
Beispiel #3
0
from modelrunner.settings import initialize,\
                                 redis_connection,\
                                 job_queue_name,\
                                 node_channel_name,\
                                 primary_queue_name,\
                                 all_nodes_channel_name,\
                                 worker_name

from modelrunner.redis_utils import enqueue_command,\
                                    publish_command,\
                                    get_all_commands

from modelrunner import PrimaryServer, WorkerServer, Job, Node, Dispatcher

# initialize
initialize()


# <helpers>
def make_config(model_name):

    base_dir = os.path.dirname(os.path.abspath(__file__))
    # use file protocol so we don't need to bring up http servers
    test_model_path = os.path.join(base_dir, "models", "test.sh")
    model_command_dict = {"test": test_model_path, "test_2": test_model_path}
    config = {
              "primary_url": "file://",
              "worker_url":  "file://",
              "worker_data_dir": os.path.join(base_dir, "worker_data"),
              "primary_data_dir": os.path.join(base_dir, "primary_data"),
              "model": model_name,