Beispiel #1
0
    def handle(self, *args, **options):
        apps = []
        try:
            from django.conf import settings
            apps = settings.GENUI_SETTINGS['APPS']
        except Exception as exp:
            # FIXME: make this not catch-all
            self.style.WARNING(
                'Failed to load GENUI_SETTINGS from settings.py. Loading internal modules only...'
            )
            from genui import apps
            apps = apps.all_()

        for app in apps:
            try:
                setupmodule = importlib.import_module(f'{app}.genuisetup')
                setupmodule.setup(force=bool(options['force']),
                                  strict=bool(options['strict']))
            except ModuleNotFoundError as exp:
                if not options['strict']:
                    self.stderr.write(
                        self.style.WARNING(
                            f'Failed to find the genuisetup module for app or extension: "{app}". No setup will be done. Reason: {exp}'
                        ))
                    continue
                else:
                    raise exp
            self.stdout.write(
                self.style.SUCCESS('Successful setup for: "%s"' % app))
Beispiel #2
0
def setup(*args, **kwargs):
    from genui.models import helpers
    from .genuimodels import bases
    from genui import apps
    for app in apps.all_():
        helpers.discoverGenuiModels(app, force=kwargs['force'], modules=["descriptors"], additional_bases=[bases.DescriptorCalculator])

    from genui.utils.init import createGroup
    from . import models

    createGroup(
        "GenUI_Users",
        [
            models.QSARModel,
            models.ModelActivity,
            models.ModelActivitySet,
            models.QSARTrainingStrategy,
        ],
        force=kwargs['force']
    )

    createGroup(
        "GenUI_Users",
        [
            models.DescriptorGroup,
        ],
        permissions=['view'],
        force=kwargs['force']
    )
Beispiel #3
0
    def create(self, validated_data):
        ret = super().create(validated_data)

        for app in apps.all_():
            try:
                created = helpers.createDefaultModels(ret, app)
                if created:
                    print(f'Created default models {", ".join([x.name for x in created])} from {app} for project {ret.name} (owned by {ret.owner.username})')
            except ModuleNotFoundError:
                pass

        return ret
Beispiel #4
0
def setup(*args, **kwargs):
    from . import signals
    from genui import apps
    from . import helpers
    for app in apps.all_():
        helpers.discoverGenuiModels(app, force=kwargs['force'])

    from genui.utils.init import createGroup
    from . import models

    createGroup(
        "GenUI_Users",
        [
            models.Model,
            models.TrainingStrategy,
            models.ValidationStrategy,
            models.BasicValidationStrategy,
            models.ModelFile,
            models.ModelParameterValue,
            models.ModelParameterBool,
            models.ModelParameterFloat,
            models.ModelParameterInt,
            models.ModelParameterStr,
            models.ModelPerformance,
            models.ModelPerfomanceNN,
            models.ModelPerformanceCV,
        ],
        force=kwargs['force']
    )

    createGroup(
        "GenUI_Users",
        [
            models.Algorithm,
            models.AlgorithmMode,
            models.ModelBuilder,
            models.ModelFileFormat,
            models.ModelParameter,
            models.ModelPerformanceMetric,
        ],
        permissions=['view'],
        force=kwargs['force']
    )
Beispiel #5
0
def setup(*args, **kwargs):
    from genui.utils.init import createGroup
    from genui import apps
    from . import models
    from . import signals

    for app in apps.all_():
        discoverExporters(app)

    createGroup("GenUI_Users", [
        models.MolSet, models.Activity, models.ActivitySet, models.Molecule,
        models.MolSetFile, models.MolSetExport
    ],
                force=kwargs['force'])

    createGroup("GenUI_Users", [
        models.ActivityTypes, models.ActivityUnits, models.MoleculePic,
        models.PictureFormat, models.MolSetExporter
    ],
                permissions=['view'],
                force=kwargs['force'])