Пример #1
0
def delete(codes):
    """
    Delete codes.

    Does not delete codes that are used by calculations
    (i.e., if there are output links)
    """
    from aiida.common.exceptions import InvalidOperation
    from aiida.orm.code import delete_code

    for code in codes:
        try:
            delete_code(code)
        except InvalidOperation as exc:
            echo.echo_critical(exc.message)

        echo.echo_success("Code '{}' deleted.".format(code.pk))
Пример #2
0
    def code_delete(self, *args):
        """
        Delete a code

        Does not delete the code if there are calculations that are using it
        (i.e., if there are output links)
        """
        from aiida.common.exceptions import InvalidOperation
        from aiida.orm.code import delete_code

        if len(args) != 1:
            print >> sys.stderr, ("after 'code delete' there should be one "
                                  "argument only, being the code id.")
            sys.exit(1)

        code = self.get_code(args[0])
        pk = code.pk
        try:
            delete_code(code)
        except InvalidOperation as e:
            print >> sys.stderr, e.message
            sys.exit(1)

        print "Code '{}' deleted.".format(pk)
Пример #3
0
    def tearDown(self):
        from aiida.orm.code import delete_code

        code = Code.get_from_string(self.CODE_LABEL)
        delete_code(code)