How to use the spython.logger.bot.error function in spython

To help you get started, we’ve selected a few spython examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github singularityhub / singularity-cli / spython / client / sign.py View on Github external
def main(args, parser, subparser):

    if check_install() is not True:
        bot.error("Cannot find Singularity! Is it installed?")
        sys.exit(1)
github singularityhub / singularity-cli / spython / utils / fileio.py View on Github external
def mkdir_p(path):
    '''mkdir_p attempts to get the same functionality as mkdir -p
    :param path: the path to create.
    '''
    try:
        os.makedirs(path)
    except OSError as e:
        if e.errno == errno.EEXIST and os.path.isdir(path):
            pass
        else:
            bot.error("Error creating path %s, exiting." % path)
            sys.exit(1)
github singularityhub / singularity-cli / spython / client / pull.py View on Github external
def main(args, parser, subparser):

    if check_install() is not True:
        bot.error("Cannot find Singularity! Is it installed?")
        sys.exit(1)
github singularityhub / singularity-cli / spython / client / mount.py View on Github external
def main(args, parser, subparser):

    if check_install() is not True:
        bot.error("Cannot find Singularity! Is it installed?")
        sys.exit(1)
github singularityhub / singularity-cli / spython / instance / cmd / iutils.py View on Github external
if not return_json:
            for i in instances:
                new_instance = Instance(
                    pid=i["pid"],
                    name=i["daemon_name"],
                    image=i["container_image"],
                    start=False,
                )

                listing.append(new_instance)
            instances = listing

    # Couldn't get UID

    elif output["return_code"] == 255:
        bot.error("Couldn't get UID")

    # Return code of 0
    else:
        bot.info("No instances found.")

    # If we are given a name, return just one
    if name is not None and len(instances) == 1:
        instances = instances[0]

    return instances
github singularityhub / singularity-cli / spython / main / instances.py View on Github external
# Otherwise, add instances to the listing
                new_instance = self.instance(
                    pid=i["pid"],
                    name=i["daemon_name"],
                    image=i["container_image"],
                    start=False,
                )

                listing.append(new_instance)
            instances = listing

    # Couldn't get UID

    elif output["return_code"] == 255:
        bot.error("Couldn't get UID")

    # Return code of 0
    else:
        bot.info("No instances found.")

    # If we are given a name, return just one
    if name is not None and instances not in [None, []]:
        if len(instances) == 1:
            instances = instances[0]

    return instances
github singularityhub / singularity-cli / spython / instance / cmd / stop.py View on Github external
if timeout:
            subgroup += ["-t", str(timeout)]

    cmd = self._init_command(subgroup, singularity_options)

    # If name is provided assume referencing an instance
    instance_name = self.name
    if name is not None:
        instance_name = name
    cmd = cmd + [instance_name]

    output = run_command(cmd, sudo=sudo, quiet=True)

    if output["return_code"] != 0:
        message = "%s : return code %s" % (output["message"], output["return_code"])
        bot.error(message)
        return output["return_code"]

    return output["return_code"]