def main(): parser = argparse.ArgumentParser(prog='simplecoin task scheduler') parser.add_argument('-l', '--log-level', choices=['DEBUG', 'INFO', 'WARN', 'ERROR'], default='INFO') args = parser.parse_args() app = create_app("scheduler", log_level=args.log_level) app.scheduler.start()
def main(): parser = argparse.ArgumentParser(prog='simplecoin task scheduler') parser.add_argument('-c', '--config', dest='configs', action='append', type=argparse.FileType('r')) parser.add_argument('-l', '--log-level', choices=['DEBUG', 'INFO', 'WARN', 'ERROR'], default='INFO') args = parser.parse_args() app = create_app("scheduler", log_level=args.log_level) app.scheduler.start()
def setUp(self, **kwargs): extra = dict() extra.update(kwargs) app = simplecoin.create_app('webserver', configs=['test.toml'], **extra) with app.app_context(): self.db = simplecoin.db self.setup_db() self.app = app self._ctx = self.app.test_request_context() self._ctx.push() self.client = self.app.test_client()
def setUp(self, **kwargs): extra = dict(main_cache=dict(CACHE_TYPE='null')) extra.update(kwargs) app = simplecoin.create_app('webserver', config='test.yml', **extra) with app.app_context(): self.db = simplecoin.db self.setup_db() self.app = app self._ctx = self.app.test_request_context() self._ctx.push() self.client = self.app.test_client()
def setUp(self, **kwargs): # Set the random seed to a fixed number, causing all use of random # to actually repeat exactly the same every time random.seed(0) extra = dict() extra.update(kwargs) app = simplecoin.create_app('webserver', configs=['test.toml'], **extra) with app.app_context(): self.db = simplecoin.db self.setup_db() self.app = app self._ctx = self.app.test_request_context() self._ctx.push() self.client = self.app.test_client()
from flask import current_app from simplecoin import create_app from simplecoin.tasks import celery from celery.bin.worker import main app = create_app(celery=True) with app.app_context(): # import celerybeat settings celery.conf.update(current_app.config['celery']) current_app.logger.info("Celery worker powering up... BBBVVVRRR!") main(app=celery)
import os import logging import datetime import time import sqlalchemy from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from simplecoin import create_app, db, coinserv, cache app = create_app() manager = Manager(app) migrate = Migrate(app, db) root = os.path.abspath(os.path.dirname(__file__) + '/../') from bitcoinrpc.authproxy import AuthServiceProxy from simplecoin.scheduler import (cleanup, run_payouts, server_status, update_online_workers, update_pplns_est, cache_user_donation, general_cleanup, update_block_state) from simplecoin.models import (Transaction, Threshold, DonationPercent, BonusPayout, OneMinuteType, FiveMinuteType, Block, MergeAddress, Payout, TransactionSummary) from simplecoin.utils import setfee_command from flask import current_app, _request_ctx_stack root = logging.getLogger() ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')) root.addHandler(ch)
import os import logging import datetime import time import sqlalchemy from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from simplecoin import create_app, db, coinserv, cache app = create_app() manager = Manager(app) migrate = Migrate(app, db) root = os.path.abspath(os.path.dirname(__file__) + '/../') from bitcoinrpc.authproxy import AuthServiceProxy from simplecoin.scheduler import (cleanup, run_payouts, server_status, update_online_workers, update_pplns_est, cache_user_donation, general_cleanup) from simplecoin.models import (Transaction, Threshold, DonationPercent, BonusPayout, OneMinuteType, FiveMinuteType, Block, MergeAddress, Payout, TransactionSummary) from simplecoin.utils import setfee_command from flask import current_app, _request_ctx_stack root = logging.getLogger() ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')) root.addHandler(ch)