示例#1
0
    def create(cls, project):
        """
        Create all the datasource tables for this project.

        """

        source = Datasource(project=project)
        source.save()

        return cls(project=project)
    def handle(self, *args, **options):
        projects = Repository.objects.all().values_list('name',flat=True)
        for project in projects:
        	for contenttype in ("jobs","objectstore"):
	        	Datasource.objects.get_or_create(
                    contenttype=contenttype,
                    dataset=1,
                    project=project,
                    host=options['host'],
                    read_only_host=options['readonly_host']
                )
        Datasource.reset_cache()
示例#3
0
    def create(cls, project, host=None):
        """
        Create all the datasource tables for this project.

        """

        if not host:
            host = settings.DATABASES["default"]["HOST"]

        for ct in [cls.CT_JOBS, cls.CT_OBJECTSTORE]:
            dataset = Datasource.get_latest_dataset(project, ct)
            source = Datasource(project=project, contenttype=ct, dataset=dataset or 1, host=host)
            source.save()

        return cls(project=project)
示例#4
0
    def handle(self, *args, **options):
        if options["reset"]:
            confirm = input("""You have requested an init of the datasources.
This will IRREVERSIBLY DESTROY all data in the per-project databases.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """)
            if confirm == "yes":
                for ds in Datasource.objects.all():
                    ds.delete()

        projects = Repository.objects.filter(active_status='active').values_list('name', flat=True)
        for project in projects:
            Datasource.objects.get_or_create(project=project)
        Datasource.reset_cache()
示例#5
0
    def handle(self, *args, **options):
        if options["reset"]:
            confirm = input("""You have requested an init of the datasources.
This will IRREVERSIBLY DESTROY all data in the per-project databases.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """)
            if confirm == "yes":
                for ds in Datasource.objects.all():
                    ds.delete()

        projects = Repository.objects.filter(
            active_status='active').values_list('name', flat=True)
        for project in projects:
            Datasource.objects.get_or_create(project=project)
        Datasource.reset_cache()
示例#6
0
    def handle(self, *args, **options):
        if options["reset"]:
            confirm = input("""You have requested an init of the datasources.
This will IRREVERSIBLY DESTROY all data in the jobs and objectstore databases.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """)
            if confirm == "yes":
                for ds in Datasource.objects.all():
                    ds.delete()

        projects = Repository.objects.filter(
            active_status='active').values_list('name', flat=True)
        for project in projects:
            for contenttype in ("jobs", "objectstore"):
                Datasource.objects.get_or_create(
                    contenttype=contenttype,
                    project=project,
                    host=options['host'],
                    read_only_host=options['readonly_host'])
        Datasource.reset_cache()
    def handle(self, *args, **options):
        if options["reset"]:
            confirm = input("""You have requested an init of the datasources.
This will IRREVERSIBLY DESTROY all data in the jobs and objectstore databases.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: """)
            if confirm == "yes":
                for ds in Datasource.objects.all():
                    ds.delete()

        projects = Repository.objects.filter(active_status='active').values_list('name', flat=True)
        for project in projects:
            for contenttype in ("jobs", "objectstore"):
                Datasource.objects.get_or_create(
                    contenttype=contenttype,
                    project=project,
                    host=options['host'],
                    read_only_host=options['readonly_host']
                )
        Datasource.reset_cache()