Skip to content

Commit ab25ec7

Browse files
committed
add option keep_input finish
1 parent f178c46 commit ab25ec7

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/vip_client/classes/VipSession.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def run_session(
563563
)
564564

565565
# Clean session data on VIP
566-
def finish(self, timeout=300, keep_output=False) -> VipSession:
566+
def finish(self, timeout=300, keep_output=False, keep_input=False) -> VipSession:
567567
"""
568568
Removes session's data from VIP servers (INPUTS and by default OUTPUTS).
569569
The downloaded outputs and the input dataset are kept on the local machine.
@@ -575,7 +575,7 @@ def finish(self, timeout=300, keep_output=False) -> VipSession:
575575
- OUTPUTS are by default deleted from VIP servers, the option `keep_output` override this behavior
576576
"""
577577
# Finish the session based on self._path_to_delete()
578-
super().finish(timeout=timeout, keep_output=keep_output)
578+
super().finish(timeout=timeout, keep_output=keep_output, keep_input=keep_input)
579579
# Check if the input data have been erased (this is not the case when get_inputs have been used)
580580
if (self._vip_input_dir != self._vip_dir / "INPUTS"
581581
and self._exists(self._vip_input_dir, location="vip")):
@@ -674,16 +674,18 @@ def get_inputs(self, session: VipSession, get_pipeline=False, get_settings=False
674674
###################################################################
675675

676676
# Path to delete during session finish()
677-
def _path_to_delete(self, **kwargs) -> dict:
677+
def _path_to_delete(self, keep_output=False, keep_input=False) -> dict:
678678
"""Returns the folders to delete during session finish, with appropriate location."""
679-
if (kwargs.get("keep_output", False)):
680-
return {
681-
self._vip_dir / "INPUTS": "vip"
682-
}
683-
else:
684-
return {
685-
self._vip_dir: "vip"
686-
}
679+
if not keep_input and not keep_output:
680+
return { self._vip_dir: "vip" }
681+
682+
result = {}
683+
684+
if not keep_input:
685+
result[self._vip_dir / "INPUTS"] = "vip"
686+
if not keep_output:
687+
result[self._vip_dir / "OUTPUTS"] = "vip"
688+
return result
687689

688690
# Method to check existence of a distant or local resource.
689691
@classmethod

0 commit comments

Comments
 (0)