Source code for kappa_sdk.user_tasks.simulation.simulated_user_task
from typing import List, Optional
from ...plot import Plot
from ...user_task import UserTask
from ...data import Data
from ...well import Well
from ...file import File
from ...document import Document
[docs]
class SimulatedUserTask(UserTask):
    """ User task object.
    Presents a KAPPA Automate user task information object.
    """
    # noinspection PyMissingConstructor
[docs]
    def __init__(self, well: Well, name: str, outputs: List[Data]):
        self.__well: Well = well
        self.__outputs: List[Data] = outputs
        self.__name: str = name 
[docs]
    def create_plot(self, plot_name: str, pane_name: Optional[str] = None, square_log_cycles: bool = False, stacked_bars: bool = False,
                    x_label: str = "", is_x_log: bool = False, labels: Optional[List[str]] = None) -> Plot:
        plot = self.__well.create_plot(plot_name, pane_name, square_log_cycles, stacked_bars, x_label, is_x_log, labels)
        self.__well.plots.append(plot)
        return plot 
    @property
    def plots(self) -> List[Plot]:
        """ Gets the list of the plot instances of the :class:`UserTask`.
        """
        return self.__well.plots
    @property
    def files(self) -> List[File]:
        """ Gets the list of the files under this :class:`UserTask`."""
        return self.__well.files
    @property
    def documents(self) -> List[Document]:
        """ Gets the list of the documents under this :class:`UserTask`."""
        return self.__well.documents
    @property
    def outputs(self) -> List[Data]:
        """ Gets the list of outputs of the :class:`UserTask`.
        """
        return self.__outputs
[docs]
    def rename(self, new_name: str) -> None:
        """ Rename the User Task"""
        print("You cannot rename a simulated user task since it does not exist as a real object in the cluster")
        pass 
[docs]
    def delete(self) -> None:
        """ Delete the User Task"""
        print("You cannot delete a simulated user task since it does not exist as a real object in the cluster")
        pass 
    @property
    def user_task_instance_id(self) -> None:  # type:ignore[override]
        """ Gets the user task id (processing service) of the :class:`UserTask` object. Since we are in simulation mode it is None"""
        return None
    @property
    def name(self) -> str:
        """ Gets the name of the :class:`UserTask`.
        """
        return self.__name
    @property
    def id(self) -> str:
        """ Gets the id of the :class:`UserTask` object"""
        return self.__well.id
    @property
    def workflow_id(self) -> Optional[str]:
        """ Get the custom workflow id of the :class:`UserTask` object. Since we are in simulation mode it is None"""
        return None
    @property
    def user_task_definition_name(self) -> None:  # type:ignore[override]
        return None
    @property
    def inputs(self) -> None:  # type:ignore[override]
        """
        Retrieves the user task inputs.
        Returns None in simulation mode"""
        return None