modelon/impact/client/operations.py
def wait(self, timeout=None, status=Status.DONE):
        """Waits until the operation achieves the set status.
        Returns the operation class instance if the set status is achieved.

        Parameters:

            timeout --
                Time to wait in seconds for achieving the status. By default
                the timeout is set to 'None', which signifies an infinite time
                to wait until the status is achieved.

            status --
                Operation status to be achieved.
                Default: Status.DONE

        Returns:

            Operation class instance if the set status is achieved.

        Raises:

            OperationTimeOutError if time exceeds set timeout.

        Example::

           model.compile(compile_options).wait(
               timeout = 120,
               status = Status.CANCELLED
           )
           workspace.execute(experiment_definition).wait(timeout = 120)
        """
        start_t = time.time()
        while True:
            logger.info(f"{self.name} in progress! Status : {self.status().name}")
            if self.status() == status:
                logger.info(f"{self.name} completed! Status : {self.status().name}")
                return self.data()

            current_t = time.time()
            if timeout and current_t - start_t > timeout:
                raise exceptions.OperationTimeOutError(
                    f"Time exceeded the set timeout - {timeout}s! "
                    f"Present status of operation is {self.status().name}!"
                )

            time.sleep(0.5)
Waits until the operation achieves the set status.
        Returns the operation class instance if the set status is achieved.

        Parameters:

            timeout --
                Time to wait in seconds for achieving the status. By default
                the timeout is set to 'None', which signifies an infinite time
                to wait until the status is achieved.

            status --
                Operation status to be achieved.
                Default: Status.DONE

        Returns:

            Operation class instance if the set status is achieved.

        Raises:

            OperationTimeOutError if time exceeds set timeout.

        Example::

           model.compile(compile_options).wait(
               timeout = 120,
               status = Status.CANCELLED
           )
           workspace.execute(experiment_definition).wait(timeout = 120)
        
Waits until the operation achieves the set status.
Returns the operation class instance if the set status is achieved.



timeout
Time to wait in seconds for achieving the status. By default
the timeout is set to 'None', which signifies an infinite time
to wait until the status is achieved.

status
Operation status to be achieved.



Operation class instance if the set status is achieved.



OperationTimeOutError if time exceeds set timeout.




Waits until the operation achieves the set status . Returns the operation class instance if the set status is achieved . timeout Time to wait in seconds for achieving the status . By default the timeout is set to ' None ' which signifies an infinite time to wait until the status is achieved . status Operation status to be achieved . Operation class instance if the set status is achieved . OperationTimeOutError if time exceeds set timeout .
def wait(self, timeout=None, status=Status.DONE):
        start_t = time.time()
        while True:
            logger.info(f"{self.name} in progress! Status : {self.status().name}")
            if self.status() == status:
                logger.info(f"{self.name} completed! Status : {self.status().name}")
                return self.data()
            current_t = time.time()
            if timeout and current_t - start_t > timeout:
                raise exceptions.OperationTimeOutError(
                    f"Time exceeded the set timeout - {timeout}s! "
                    f"Present status of operation is {self.status().name}!"
                )
            time.sleep(0.5)
def wait ( self , timeout = None , status = Status . DONE ) : start_t = time . time ( ) while True : logger . info ( f"{self.name} in progress! Status : {self.status().name}" ) if self . status ( ) == status : logger . info ( f"{self.name} completed! Status : {self.status().name}" ) return self . data ( ) current_t = time . time ( ) if timeout and current_t - start_t > timeout : raise exceptions . OperationTimeOutError ( f"Time exceeded the set timeout - {timeout}s! " f"Present status of operation is {self.status().name}!" ) time . sleep ( 0.5 )
Waits until the operation achieves the set status.
Waits until the operation achieves the set status .
"""Waits until the operation achieves the set status.
        Returns the operation class instance if the set status is achieved.

        Parameters:

            timeout --
                Time to wait in seconds for achieving the status. By default
                the timeout is set to 'None', which signifies an infinite time
                to wait until the status is achieved.

            status --
                Operation status to be achieved.
                Default: Status.DONE

        Returns:

            Operation class instance if the set status is achieved.

        Raises:

            OperationTimeOutError if time exceeds set timeout.

        Example::

           model.compile(compile_options).wait(
               timeout = 120,
               status = Status.CANCELLED
           )
           workspace.execute(experiment_definition).wait(timeout = 120)
        """
self
timeout
status