Esempio n. 1
0
def devel_setproperty(prop, value):
    """Set the global PROPERTY to VALUE in the configuration file."""
    from aiida.common.setup import set_property

    try:
        set_property(prop, value)
    except ValueError:
        echo.echo_critical(
            '{} is not a recognized property, call describeproperties to see a list'
            .format(prop))
    except Exception as exception:  # pylint: disable=broad-except
        echo.echo_critical('{} while storing the property: {}'.format(
            type(exception).__name__, exception.message))
    else:
        echo.echo_success('property {} set to {}'.format(prop, value))
Esempio n. 2
0
    def run_setproperty(self, *args):
        """
        Define a global AiiDA property in the config file in .aiida.

        Only properties in the _property_table of aiida.common.setup can
        be modified.
        """
        from aiida.common.setup import set_property

        if len(args) != 2:
            print >> sys.stderr, ("usage: {} PROPERTYNAME PROPERTYVALUE".format(
                self.get_full_command_name()))
            sys.exit()

        try:
            set_property(args[0], args[1])
        except Exception as e:
            print >> sys.stderr, ("{} while storing the "
                                  "property: {}".format(type(e).__name__, e.message))
            sys.exit(1)
Esempio n. 3
0
 def tearDown(self):
     self.migrate_db_with_non_testing_migrations("head")
     set_property('logging.alembic_loglevel',
                  logging.getLevelName(self.init_alemb_log_level))
Esempio n. 4
0
 def setUp(self):
     self.init_alemb_log_level = get_property('logging.alembic_loglevel')
     set_property('logging.alembic_loglevel',
                  logging.getLevelName(logging.ERROR))
     self.migrate_db_with_non_testing_migrations("base")