示例#1
0
        user_service.create_user("admin",
                                 'display name',
                                 "pass",
                                 role=model.ROLE_ADMINISTRATOR,
                                 email="*****@*****.**",
                                 validated=True,
                                 skip_import=True)
        admin = user_service.get_administrators()[0]

    ## Do the actual import of a project from ZIP:
    import_service = ImportService()
    import_service.import_project_structure(project_path, admin.id)

    print("Project imported successfully. Check the Web UI!")


if __name__ == '__main__':
    from tvb.config.init.initializer import command_initializer

    command_initializer(skip_import=True)

    if len(argv) < 2:
        print("No Project path given!!!")
        exit(1)

    PROJECT_PATH = str(argv[1])

    print("We will try to import project at path " + PROJECT_PATH)

    run_import(PROJECT_PATH)
示例#2
0
from tvb.config.init.initializer import command_initializer
from tvb.config.init.introspector_registry import IntrospectionRegistry
from tvb.core.adapters.abcadapter import ABCAdapter
from tvb.core.entities.file.files_helper import FilesHelper
from tvb.core.entities.file.simulator.view_model import SimulatorAdapterModel
from tvb.core.entities.model.model_burst import BurstConfiguration
from tvb.core.entities.model.model_operation import STATUS_FINISHED
from tvb.core.entities.storage import dao
from tvb.core.neocom import h5
from tvb.core.services.algorithm_service import AlgorithmService
from tvb.core.services.operation_service import OperationService
from tvb.core.services.project_service import ProjectService
from tvb.core.services.simulator_service import SimulatorService
from tvb.core.services.user_service import UserService

command_initializer()
LOG = get_logger(__name__)


def list_projects():
    fmt = "%24s %5s"
    print(fmt % ('name', 'id'))
    for p in dao.get_all_projects():
        print(fmt % (p.name, p.id))


def list_datatypes(project_id):
    fmt = "%24s %16s %5s %32s %12s"
    print(fmt % ('type', 'tag', 'id', 'gid', 'date'))
    for dt in dao.get_datatypes_in_project(project_id):
        print(fmt % (dt.type, dt.user_tag_1, dt.id, dt.gid, dt.create_date))