cwltool.singularity
===================

.. py:module:: cwltool.singularity

.. autoapi-nested-parse::

   Support for executing Docker format containers using Singularity {2,3}.x or Apptainer 1.x.



Classes
-------

.. autoapisummary::

   cwltool.singularity.SingularityCommandLineJob


Functions
---------

.. autoapisummary::

   cwltool.singularity.get_version
   cwltool.singularity.is_apptainer_1_or_newer
   cwltool.singularity.is_apptainer_1_1_or_newer
   cwltool.singularity.is_version_2_6
   cwltool.singularity.is_version_3_or_newer
   cwltool.singularity.is_version_3_1_or_newer
   cwltool.singularity.is_version_3_4_or_newer
   cwltool.singularity.is_version_3_9_or_newer
   cwltool.singularity.is_version_3_10_or_newer


Module Contents
---------------

.. py:function:: get_version()

   Parse the output of 'singularity --version' to determine the flavor and version.

   Both pieces of information will be cached.

   :returns: A tuple containing:
             - A parsed Version object.
             - A string with the name of the singularity flavor.


.. py:function:: is_apptainer_1_or_newer()

   Check if apptainer singularity distribution is version 1.0 or higher.

   Apptainer v1.0.0 is compatible with SingularityCE 3.9.5.
   See: https://github.com/apptainer/apptainer/releases


.. py:function:: is_apptainer_1_1_or_newer()

   Check if apptainer singularity distribution is version 1.1 or higher.


.. py:function:: is_version_2_6()

   Check if this singularity version is exactly version 2.6.

   Also returns False if the flavor is not singularity or singularity-ce.


.. py:function:: is_version_3_or_newer()

   Check if this version is singularity version 3 or newer or equivalent.


.. py:function:: is_version_3_1_or_newer()

   Check if this version is singularity version 3.1 or newer or equivalent.


.. py:function:: is_version_3_4_or_newer()

   Detect if Singularity v3.4+ is available.


.. py:function:: is_version_3_9_or_newer()

   Detect if Singularity v3.9+ is available.


.. py:function:: is_version_3_10_or_newer()

   Detect if Singularity v3.10+ is available.


.. py:class:: SingularityCommandLineJob(builder, joborder, make_path_mapper, requirements, hints, name)

   Bases: :py:obj:`cwltool.job.ContainerCommandLineJob`

   .. autoapi-inheritance-diagram:: cwltool.singularity.SingularityCommandLineJob
      :parts: 1


   Commandline job using containers.


   .. py:method:: get_image(dockerRequirement, pull_image, tmp_outdir_prefix, force_pull = False, sandbox_base_path = None)
      :staticmethod:


      Acquire the software container image in the specified dockerRequirement.

      Uses Singularity and returns the success as a bool. Updates the
      provided dockerRequirement with the specific dockerImageId to the full
      path of the local image, if found. Likewise the
      dockerRequirement['dockerPull'] is updated to a docker:// URI if needed.



   .. py:method:: get_from_requirements(r, pull_image, force_pull, tmp_outdir_prefix, image_base_path = None)

      Return the filename of the Singularity image.

      (e.g. hello-world-latest.{img,sif}).



   .. py:method:: append_volume(runtime, source, target, writable = False)
      :staticmethod:


      Add binding arguments to the runtime list.



   .. py:method:: add_file_or_directory_volume(runtime, volume, host_outdir_tgt)

      Append volume a file/dir mapping to the runtime option list.



   .. py:method:: add_writable_file_volume(runtime, volume, host_outdir_tgt, tmpdir_prefix)

      Append a writable file mapping to the runtime option list.



   .. py:method:: add_writable_directory_volume(runtime, volume, host_outdir_tgt, tmpdir_prefix)

      Append a writable directory mapping to the runtime option list.



   .. py:method:: create_runtime(env, runtime_context)

      Return the Singularity runtime list of commands and options.



