def access_functions(function, args): """ This function routes the passed arguments to the function selected by the function parameter. """ if function == "request": from access.request import run as _request return _request(args) elif function == "run_calculation": from access.run_calculation import run as _run_calculation return _run_calculation(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(access_functions))
def compute_functions(function, args): """These are all of the additional functions for the compute service""" if function == "submit_job": from compute.submit_job import run as _submit_job return _submit_job(args) elif function == "get_job": from compute.get_job import run as _get_job return _get_job(args) elif function == "get_pending_job_uids": from compute.get_pending_job_uids import run as _get_job_uids return _get_job_uids(args) elif function == "set_cluster": from compute.set_cluster import run as _set_cluster return _set_cluster(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(compute_functions))
from hugs_service.cleardatasources import clear_datasources return clear_datasources(args) if function == "status": from hugs_service.status import status return status() if function == "job_runner": from hugs_service.jobrunner import job_runner return job_runner(args) if function == "rank_sources": from hugs_service.rank_sources import rank_sources return rank_sources(args) if function == "get_sources": from hugs_service.get_sources import get_sources return get_sources(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(hugs_functions))
Returns: function: If valid function selected, function with args passed else None """ if function == "get_session_info": from admin.get_session_info import run as _get_session_info return _get_session_info(args) elif function == "login": from admin.login import run as _login return _login(args) elif function == "logout": from admin.logout import run as _logout return _logout(args) elif function == "register": from admin.register import run as _register return _register(args) elif function == "request_login": from admin.request_login import run as _request_login return _request_login(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(identity_functions))
def registry_functions(function, args): """This function routes calls to sub-functions, thereby allowing a single registry function to stay hot for longer """ if function == "get_service": from registry.get_service import run as _get_service return _get_service(args) elif function == "register_service": from registry.register_service import run as _register_service return _register_service(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(registry_functions))
elif function == "list_drives": from storage.list_drives import run as _list_drives return _list_drives(args) elif function == "list_versions": from storage.list_versions import run as _list_versions return _list_versions(args) elif function == "open_drive": from storage.open_drive import run as _open_drive return _open_drive(args) elif function == "open_uploader": from storage.open_uploader import run as _open_uploader return _open_uploader(args) elif function == "resolve_par": from storage.resolve_par import run as _resolve_par return _resolve_par(args) elif function == "upload": from storage.upload import run as _upload return _upload(args) elif function == "upload_chunk": from storage.upload_chunk import run as _upload_chunk return _upload_chunk(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(storage_functions))
function: If valid function selected, function with args passed else None """ if function == "cash_cheque": from accounting.cash_cheque import run as _cash_cheque return _cash_cheque(args) elif function == "create_account": from accounting.create_account import run as _create_account return _create_account(args) elif function == "deposit": from accounting.deposit import run as _deposit return _deposit(args) elif function == "get_account_uids": from accounting.get_account_uids import run as _get_account_uids return _get_account_uids(args) elif function == "get_info": from accounting.get_info import run as _get_info return _get_info(args) elif function == "perform": from accounting.perform import run as _perform return _perform(args) else: from admin.handler import MissingFunctionError raise MissingFunctionError() if __name__ == "__main__": import fdk from admin.handler import create_async_handler fdk.handle(create_async_handler(accounting_functions))