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

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

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

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

    create_db(False, True)
"""
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
Exemple #10
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
Exemple #11
0
 def tearDown(self):
     models.db.close_db(None)
     models.create_db(False, True)
"""
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):