Ejemplo n.º 1
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
     redis_connection.flushdb()
Ejemplo n.º 2
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
     redis_connection.flushdb()
Ejemplo n.º 3
0
 def setUp(self):
     models.create_db(True, True)
     models.init_db()
Ejemplo n.º 4
0
def create_tables():
    """Create the database tables."""
    from redash.models import create_db, init_db

    create_db(True, False)
    init_db()
Ejemplo n.º 5
0
 def setUp(self):
     models.create_db(True, True)
     models.init_db()
Ejemplo n.º 6
0
def create_tables():
    """Create the database tables."""
    from redash.models import create_db, init_db

    create_db(True, False)
    init_db()
Ejemplo n.º 7
0
def drop_tables():
    """Drop the database tables."""
    from redash.models import create_db

    create_db(False, True)
Ejemplo n.º 8
0
def drop_tables():
    """Drop the database tables."""
    from redash.models import create_db

    create_db(False, True)
Ejemplo n.º 9
0
"""
Script to test concurrency (multithreading/multiprocess) issues with the workers. Use with caution.
"""
import json
import atfork
atfork.monkeypatch_os_fork_functions()
import atfork.stdlib_fixer
atfork.stdlib_fixer.fix_logging_module()

import time
from redash.data import worker
from redash import models, data_manager, redis_connection

if __name__ == '__main__':
    models.create_db(True, False)

    print "Creating data source..."
    data_source = models.DataSource.create(name="Concurrency",
                                           type="pg",
                                           options="dbname=postgres")

    print "Clear jobs/hashes:"
    redis_connection.delete("jobs")
    query_hashes = redis_connection.keys("query_hash_*")
    if query_hashes:
        redis_connection.delete(*query_hashes)

    starting_query_results_count = models.QueryResult.select().count()
    jobs_count = 5000
    workers_count = 10
Ejemplo n.º 10
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
Ejemplo n.º 11
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
Ejemplo n.º 12
0
"""
Script to test concurrency (multithreading/multiprocess) issues with the workers. Use with caution.
"""
import json
import atfork
atfork.monkeypatch_os_fork_functions()
import atfork.stdlib_fixer
atfork.stdlib_fixer.fix_logging_module()

import time
from redash.data import worker
from redash import models, data_manager, redis_connection

if __name__ == '__main__':
    models.create_db(True, False)

    print "Creating data source..."
    data_source = models.DataSource.create(name="Concurrency", type="pg", options="dbname=postgres")

    print "Clear jobs/hashes:"
    redis_connection.delete("jobs")
    query_hashes = redis_connection.keys("query_hash_*")
    if query_hashes:
        redis_connection.delete(*query_hashes)

    starting_query_results_count = models.QueryResult.select().count()
    jobs_count = 5000
    workers_count = 10

    print "Creating jobs..."
    for i in xrange(jobs_count):