def __init__(self, config="config/askomics.test.ini"): """Summary Parameters ---------- config : str, optional Description """ # Config self.config = config self.dir_path = tempfile.mkdtemp(prefix="askotest_") self.db_path = "{}/database.db".format(self.dir_path) # create app self.app = create_app(config=self.config) create_celery(self.app) self.app.iniconfig.set('askomics', 'data_directory', self.dir_path) self.app.iniconfig.set('askomics', 'database_path', self.db_path) # context self.ctx = self.app.app_context() self.ctx.push() # Client self.client = self.app.test_client() self.session = {} # Galaxy self.gurl = "http://localhost:8081" self.gkey = "fakekey" self.galaxy_history = None self.init_database()
def __init__(self): """Get Args""" parser = argparse.ArgumentParser( description="Update base_url for all graphs") parser.add_argument("-c", "--config-file", type=str, help="AskOmics config file", required=True) parser.add_argument("-o", "--old_url", type=str, help="Old base url", required=True) parser.add_argument("-n", "--new_url", type=str, help="New base url", required=True) self.args = parser.parse_args() if not (self.args.old_url and self.args.new_url): print("Error: old_url and new_url must not be empty") sys.exit(1) self.check_urls(self.args.old_url, self.args.new_url) self.application = create_app(config=self.args.config_file) self.celery = create_celery(self.application) self.session = {} starter = Start(self.application, self.session) starter.start()
def __init__(self): """Get Args""" parser = argparse.ArgumentParser( description="Upload files from a directory to AskOmics") parser.add_argument("-c", "--config-file", type=str, help="AskOmics config file", required=True) parser.add_argument("-d", "--files-directory", type=str, help="Directory of files to upload", required=True) parser.add_argument("-k", "--api-key", type=str, help="AskOmics user apikey", required=True) self.args = parser.parse_args() self.application = create_app(config=self.args.config_file) self.celery = create_celery(self.application) self.session = {} self.user = None self.chunk_size = 1024 * 1024 * 10 # 10MB starter = Start(self.application, self.session) starter.start() self.authenticate_user()
def __init__(self): """Get Args""" parser = argparse.ArgumentParser( description="Add a new user into AskOmics database") parser.add_argument("-c", "--config-file", type=str, help="AskOmics config file", required=True) parser.add_argument("-f", "--first-name", type=str, help="User first name", default="Ad") parser.add_argument("-l", "--last-name", type=str, help="User last name", default="Min") parser.add_argument("-u", "--username", type=str, help="User username", default="admin") parser.add_argument("-p", "--password", type=str, help="User password", default="admin") parser.add_argument("-e", "--email", type=str, help="User email", default="*****@*****.**") parser.add_argument("-k", "--api-key", type=str, help="User API key", default="admin") parser.add_argument("-g", "--galaxy-url", type=str, help="Galaxy URL") parser.add_argument("-gk", "--galaxy-apikey", type=str, help="Galaxy API key") self.args = parser.parse_args() self.application = create_app(config=self.args.config_file) self.celery = create_celery(self.application) self.session = {} self.user = None starter = Start(self.application, self.session) starter.start()
def __init__(self): """Get Args""" parser = argparse.ArgumentParser( description="Update base_url for all graphs") parser.add_argument("-c", "--config-file", type=str, help="AskOmics config file", required=True) self.args = parser.parse_args() self.application = create_app(config=self.args.config_file) self.celery = create_celery(self.application) self.session = {} starter = Start(self.application, self.session) starter.start()
celery : Celery Celery object """ import sys import traceback from askomics.app import create_app, create_celery from askomics.libaskomics.Dataset import Dataset from askomics.libaskomics.DatasetsHandler import DatasetsHandler from askomics.libaskomics.FilesHandler import FilesHandler from askomics.libaskomics.Result import Result from askomics.libaskomics.SparqlQueryBuilder import SparqlQueryBuilder from askomics.libaskomics.SparqlQueryLauncher import SparqlQueryLauncher app = create_app(config='config/askomics.ini') celery = create_celery(app) @celery.task(bind=True, name="integrate") def integrate(self, session, data, host_url): """Integrate a file into the triplestore Parameters ---------- session : dict AskOmics session data : dict fileId: file to integrate public: integrate as public or private data host_url : string AskOmics host url
from askomics.app import create_app, create_celery application = create_app(config='config/askomics.ini') celery = create_celery(application) if __name__ == '__main__': application.run()