@@ -1940,29 +1940,49 @@ def isMainNode(self) -> bool:
19401940
19411941 @Slot (result = bool )
19421942 def canBeStopped (self ) -> bool :
1943+ """
1944+ Return True if this node can be stopped, False otherwise. A node can be stopped if:
1945+ - it has the "RUNNING" status (it is currently being computed)
1946+ - it is executed locally and started from this Meshroom session OR it is executed externally on a render farm
1947+ (and is thus associated to a job name). A node that is executed externally but without an associated job is
1948+ likely a node that was started from another Meshroom instance, and thus cannot be stopped from this one.
1949+ """
19431950 if not self .isComputableType :
19441951 return False
19451952 if self .isCompatibilityNode :
19461953 return False
19471954 # Only locked nodes running in local with the same
19481955 # computeSessionUid as the Meshroom instance can be stopped
1949- return (self .getGlobalStatus () == Status .RUNNING and
1950- self .globalExecMode == ExecMode .LOCAL .name and
1951- self .isMainNode () and
1952- self .initFromThisSession ())
1956+ return (self .getGlobalStatus () == Status .RUNNING and self .isMainNode () and
1957+ (
1958+ (self .globalExecMode == ExecMode .LOCAL .name and self .initFromThisSession ())
1959+ or
1960+ (self .globalExecMode == ExecMode .EXTERN .name and self ._nodeStatus .jobName != "UNKNOWN" )
1961+ )
1962+ )
19531963
19541964 @Slot (result = bool )
19551965 def canBeCanceled (self ) -> bool :
1966+ """
1967+ Return True if this node can be canceled, False otherwise. A node can be canceled if:
1968+ - it has the "SUBMITTED" status (it is not running yet, but is expected to be in the near future)
1969+ - it is executed locally and started from this Meshroom session OR it is executed externally on a render farm
1970+ (and is thus associated to a job name). A node that is executed externally but without an associated job is
1971+ likely a node that was started from another Meshroom instance, and thus cannot be canceled from this one.
1972+ """
19561973 if not self .isComputableType :
19571974 return False
19581975 if self .isCompatibilityNode :
19591976 return False
19601977 # Only locked nodes submitted in local with the same
19611978 # computeSessionUid as the Meshroom instance can be canceled
1962- return (self .getGlobalStatus () == Status .SUBMITTED and
1963- self .globalExecMode == ExecMode .LOCAL .name and
1964- self .isMainNode () and
1965- self .initFromThisSession ())
1979+ return (self .getGlobalStatus () == Status .SUBMITTED and self .isMainNode () and
1980+ (
1981+ (self .globalExecMode == ExecMode .LOCAL .name and self .initFromThisSession ())
1982+ or
1983+ (self .globalExecMode == ExecMode .EXTERN .name and self ._nodeStatus .jobName != "UNKNOWN" )
1984+ )
1985+ )
19661986
19671987 def hasImageOutputAttribute (self ) -> bool :
19681988 """
0 commit comments