@@ -1762,7 +1762,7 @@ class InvocationStatusChoices(TextChoices):
17621762 CANCELLED = "CANCELLED" , _ ("Cancelled" )
17631763
17641764
1765- class Invocation (UUIDModel ):
1765+ class Invocation (CIVForObjectMixin , UUIDModel ):
17661766 StatusChoices = InvocationStatusChoices
17671767
17681768 endpoint = models .ForeignKey (Endpoint , on_delete = models .PROTECT )
@@ -1861,6 +1861,13 @@ def orchestrator_kwargs(self):
18611861 def orchestrator (self ):
18621862 return EndpointOrchestrator (** self .orchestrator_kwargs )
18631863
1864+ @property
1865+ def is_editable (self ):
1866+ if self .status == InvocationStatusChoices .VALIDATING_INPUTS :
1867+ return True
1868+ else :
1869+ return False
1870+
18641871 @cached_property
18651872 def inputs_complete (self ):
18661873 # check if all inputs are present and if they all have a value
@@ -1894,3 +1901,31 @@ def update_status(
18941901 self .invoke_duration = invoke_duration
18951902
18961903 self .save ()
1904+
1905+ def add_civ (self , * , civ ):
1906+ super ().add_civ (civ = civ )
1907+ return self .inputs .add (civ )
1908+
1909+ def remove_civ (self , * , civ ):
1910+ super ().remove_civ (civ = civ )
1911+ return self .inputs .remove (civ )
1912+
1913+ def get_civ_for_interface (self , interface ):
1914+ return self .inputs .get (interface = interface )
1915+
1916+ def process_civ_data_objects_and_execute_linked_task (
1917+ self , * , civ_data_objects , user , linked_task = None
1918+ ):
1919+ from grandchallenge .algorithms .tasks import (
1920+ execute_invocation_for_inputs ,
1921+ )
1922+
1923+ linked_task = execute_invocation_for_inputs .signature (
1924+ kwargs = {"invocation_pk" : str (self .pk )}, immutable = True
1925+ )
1926+
1927+ return super ().process_civ_data_objects_and_execute_linked_task (
1928+ civ_data_objects = civ_data_objects ,
1929+ user = user ,
1930+ linked_task = linked_task ,
1931+ )
0 commit comments