from tvb.core.entities.storage import dao from tvb.core.services.flow_service import FlowService from tvb.core.services.operation_service import OperationService from new_importer import FooDataImporter ## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc) if __name__ == "__main__": flow_service = FlowService() operation_service = OperationService() ## This ID of a project needs to exists in Db, and it can be taken from the WebInterface: project = dao.get_project_by_id(1) ## This is our new added Importer: adapter_instance = FooDataImporter() ## We need to store a reference towards the new algorithms also in DB: # First select the category of uploaders: upload_category = dao.get_uploader_categories()[0] # check if the algorithm has been added in DB already algorithm = dao.get_algorithm_by_module(FooDataImporter.__module__, FooDataImporter.__name__) if algorithm is None: # not stored in DB previously, we will store it now: algorithm = Algorithm(FooDataImporter.__module__, FooDataImporter.__name__, upload_category.id) algorithm = dao.store_entity(algorithm) adapter_instance.stored_adapter = algorithm ## Prepare the input algorithms as if they were coming from web UI submit:
from tvb.core.services.flow_service import FlowService from tvb.core.services.operation_service import OperationService from new_importer import FooDataImporter ## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc) if __name__ == "__main__": flow_service = FlowService() operation_service = OperationService() ## This ID of a project needs to exists in Db, and it can be taken from the WebInterface: project = dao.get_project_by_id(1) ## This is our new added Importer: adapter_instance = FooDataImporter() ## We need to store a reference towards the new algorithms also in DB: # First select the category of uploaders: upload_category = dao.get_uploader_categories()[0] # check if the algorithm has been added in DB already my_group = dao.find_group(FooDataImporter.__module__, FooDataImporter.__name__) if my_group is None: # not stored in DB previously, we will store it now: my_group = AlgorithmGroup(FooDataImporter.__module__, FooDataImporter.__name__, upload_category.id) my_group = dao.store_entity(my_group) dao.store_entity(Algorithm(my_group.id, "", "FooName")) adapter_instance.algorithm_group = my_group ## Prepare the input algorithms as if they were coming from web UI submit: #launch_args = {"array_data": "[1, 2, 3, 4, 5]"}
from tvb.core.entities.storage import dao from tvb.core.services.flow_service import FlowService from tvb.core.services.operation_service import OperationService from new_importer import FooDataImporter ## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc) if __name__ == "__main__": flow_service = FlowService() operation_service = OperationService() ## This ID of a project needs to exists in Db, and it can be taken from the WebInterface: project = dao.get_project_by_id(1) ## This is our new added Importer: adapter_instance = FooDataImporter() ## We need to store a reference towards the new algorithms also in DB: # First select the category of uploaders: upload_category = dao.get_uploader_categories()[0] # check if the algorithm has been added in DB already my_group = dao.find_group(FooDataImporter.__module__, FooDataImporter.__name__) if my_group is None: # not stored in DB previously, we will store it now: my_group = AlgorithmGroup(FooDataImporter.__module__, FooDataImporter.__name__, upload_category.id) my_group = dao.store_entity(my_group) dao.store_entity(Algorithm(my_group.id, "", "FooName")) adapter_instance.algorithm_group = my_group
from tvb.core.services.flow_service import FlowService from tvb.core.services.operation_service import OperationService from new_importer import FooDataImporter ## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc) if __name__ == "__main__": flow_service = FlowService() operation_service = OperationService() ## This ID of a project needs to exists in Db, and it can be taken from the WebInterface: project = dao.get_project_by_id(1) ## This is our new added Importer: adapter_instance = FooDataImporter() ## We need to store a reference towards the new algorithms also in DB: # First select the category of uploaders: upload_category = dao.get_uploader_categories()[0] # check if the algorithm has been added in DB already algorithm = dao.get_algorithm_by_module(FooDataImporter.__module__, FooDataImporter.__name__) if algorithm is None: # not stored in DB previously, we will store it now: algorithm = Algorithm(FooDataImporter.__module__, FooDataImporter.__name__, upload_category.id) algorithm = dao.store_entity(algorithm) adapter_instance.stored_adapter = algorithm ## Prepare the input algorithms as if they were coming from web UI submit: #launch_args = {"array_data": "[1, 2, 3, 4, 5]"} launch_args = {"array_data": "demo_array.txt"}