def state(self, container_id=None, sudo=None, sync_socket=None):

    ''' get the state of an OciImage, if it exists. The optional states that
        can be returned are created, running, stopped or (not existing).

        Equivalent command line example:      
           singularity oci state <container_ID>
          
        Parameters
        ==========
        container_id: the id to get the state of.
        sudo: Add sudo to the command. If the container was created by root,
              you need sudo to interact and get its state.
        sync_socket: the path to the unix socket for state synchronization

        Returns
        =======
        state: a parsed json of the container state, if exists. If the
               container is not found, None is returned.
    '''
    sudo = self._get_sudo(sudo)
    container_id = self.get_container_id(container_id)

    # singularity oci state
    cmd = self._init_command('state')

    if sync_socket != None:
        cmd = cmd + ['--sync-socket', sync_socket]

    # Finally, add the container_id
    cmd.append(container_id)

    # Get the instance state
    result = self._run_command(cmd, sudo=sudo, quiet=True)

    if result != None:

        # If successful, a string is returned to parse
        if isinstance(result, str):
            return json.loads(result)
def state ( self , container_id = None , sudo = None , sync_socket = None ) : sudo = self . _get_sudo ( sudo ) container_id = self . get_container_id ( container_id ) cmd = self . _init_command ( 'state' ) if sync_socket != None : cmd = cmd + [ '--sync-socket' , sync_socket ] cmd . append ( container_id ) result = self . _run_command ( cmd , sudo = sudo , quiet = True ) if result != None : if isinstance ( result , str ) : return json . loads ( result )
get the state of an OciImage, if it exists. The optional states that
        can be returned are created, running, stopped or (not existing).

        Equivalent command line example:      
           singularity oci state <container_ID>
          
        Parameters
        ==========
        container_id: the id to get the state of.
        sudo: Add sudo to the command. If the container was created by root,
              you need sudo to interact and get its state.
        sync_socket: the path to the unix socket for state synchronization

        Returns
        =======
        state: a parsed json of the container state, if exists. If the
               container is not found, None is returned.