How to use the spython.logger.bot 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 / main / base / __init__.py View on Github external
def _check_install(self):
        """ensure that singularity is installed, and exit if not.
        """
        if check_install() is not True:
            bot.exit("Cannot find Singularity! Is it installed?")
github singularityhub / singularity-cli / spython / oci / __init__.py View on Github external
def get_container_id(self, container_id=None):
        """ a helper function shared between functions that will return a 
            container_id. First preference goes to a container_id provided by
            the user at runtime. Second preference goes to the container_id
            instantiated with the client.

            Parameters
            ==========
            container_id: image uri to parse (required)
        """

        # The user must provide a container_id, or have one with the client
        if container_id is None and self.container_id is None:
            bot.exit("You must provide a container_id.")

        # Choose whichever is not None, with preference for function provided
        container_id = container_id or self.container_id
        return container_id
github singularityhub / singularity-cli / spython / client / verify.py View on Github external
def main(args, options):

    if check_install() is not True:
        bot.error("Cannot find Singularity! Is it installed?")
        sys.exit(1)
github singularityhub / singularity-cli / spython / image / cmd / create.py View on Github external
size: image sizein MiB, default is 1024MiB
        filesystem: supported file systems ext3/ext4 (ext[2/3]: default ext3
        singularity_options: a list of options to provide to the singularity client
    """
    from spython.utils import check_install

    check_install()

    cmd = self.init_command("image.create", singularity_options)
    cmd = cmd + ["--size", str(size), image_path]

    output = self.run_command(cmd, sudo=sudo)
    self.println(output)

    if not os.path.exists(image_path):
        bot.exit("Could not create image %s" % image_path)

    return image_path
github singularityhub / singularity-cli / spython / client / siflist.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 / recipe.py View on Github external
parser = get_parser('singularity')

    # If the parser still isn't defined, no go.
    if parser is None:
        bot.exit('Please provide a Dockerfile or Singularity recipe, or define the --parser type.')

    # If the writer needs auto-detect
    if args.writer == "auto":
        if parser.name == "docker":
            writer = get_writer('singularity')
        else:
            writer = get_writer('docker')

    # If the writer still isn't defined, no go
    if writer is None:
        bot.exit('Please define the --writer type.')

    # Initialize the chosen parser
    recipeParser = parser(args.files[0])

    # By default, discover entrypoint / cmd from Dockerfile
    entrypoint = "/bin/bash"
    force = False

    if args.entrypoint is not None:
        entrypoint = args.entrypoint

        # This is only done if the user intended to print json here
        recipeParser.entrypoint = args.entrypoint
        recipeParser.cmd = None
        force = True
github singularityhub / singularity-cli / spython / main / build.py View on Github external
if recipe is None:
        recipe = "Singularity"

        if not os.path.exists(recipe):
            bot.exit("Cannot find %s, exiting." % image)

    if image is None:
        if re.search("(docker|shub|library)://", recipe) and not robot_name:
            image = self._get_filename(recipe, ext)
        else:
            image = "%s.%s" % (self.RobotNamer.generate(), ext)

    # Does the user want a custom build folder?
    if build_folder is not None:
        if not os.path.exists(build_folder):
            bot.exit("%s does not exist!" % build_folder)
        image = os.path.join(build_folder, image)

    # The user wants to run an isolated build
    if isolated:
        cmd.append("--isolated")

    if sandbox:
        cmd.append("--sandbox")

    elif writable:
        cmd.append("--writable")

    cmd = cmd + options + [image, recipe]

    if not stream:
        self._run_command(