Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Removed unneeeded "container" argument because now the install.sh scr…
Browse files Browse the repository at this point in the history
…ipts will replace the executable with a script that calls the container
  • Loading branch information
daminton committed May 26, 2023
1 parent 64d6a30 commit 6cce4f0
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def __init__(self,read_param: bool = False,
integrator : {"symba","rmvs","whm","helio"}, default "symba"
Name of the n-body integrator that will be used when executing a run.
Parameter input file equivalent: None
container : {"docker", "singularity"}, default None
Specify whether the driver exectuable is run from a Docker or Singularity container. Setting to `None`
read_param : bool, default False
Read the parameter file given by `param_file`.
param_file : str, path-like, or file-lke, default "param.in"
Expand Down Expand Up @@ -340,7 +338,6 @@ def __init__(self,read_param: bool = False,
self.init_cond = xr.Dataset()
self.encounters = xr.Dataset()
self.collisions = xr.Dataset()
self.container = None

# Set the location of the parameter input file, choosing the default if it isn't specified.
self.simdir = Path.cwd() / Path(simdir)
Expand Down Expand Up @@ -408,8 +405,6 @@ def _run_swiftest_driver(self):

# Get current environment variables
env = os.environ.copy()
if self.container == "SINGULARITY" and "SWIFTEST_SIF" not in env:
env['SWIFTEST_SIF'] = Path(self.binary_source).parent.parent / "swiftest.sif"
cmd = f"{env['SHELL']} -l {self.driver_script}"


Expand Down Expand Up @@ -835,7 +830,6 @@ def set_parameter(self, verbose: bool = True, **kwargs):
"encounter_save" : "NONE",
"coarray" : False,
"simdir" : self.simdir,
"container" : None,
}
param_file = kwargs.pop("param_file",None)

Expand Down Expand Up @@ -899,7 +893,6 @@ def get_parameter(self, **kwargs):
def set_integrator(self,
codename: None | Literal["Swiftest", "Swifter", "Swift"] = "Swiftest",
integrator: Literal["symba","rmvs","whm","helio"] | None = None,
container: Literal["docker", "singularity"] | None = None,
mtiny: float | None = None,
gmtiny: float | None = None,
verbose: bool | None = None,
Expand All @@ -912,10 +905,6 @@ def set_integrator(self,
codename : {"swiftest", "swifter", "swift"}, optional
integrator : {"symba","rmvs","whm","helio"}, optional
Name of the n-body integrator that will be used when executing a run.
container : {"docker", "singularity"}, default None
Specify whether the driver exectuable is run from a Docker or Singularity container.
Setting to `None` uses the local executable.
*Note*: Only valid for Swiftest.
mtiny : float, optional
The minimum mass of fully interacting bodies. Bodies below this mass interact with the larger bodies,
but not each other (SyMBA only). *Note.* Only mtiny or gmtiny is accepted, not both.
Expand All @@ -938,14 +927,6 @@ def set_integrator(self,

update_list = []

if container is not None:
valid_container = ["DOCKER", "SINGULARITY"]
if container.upper() not in valid_container:
warnings.warn(f"{container} is not a valid container type. Valid options are None, ",",".join(valid_container),stacklevel=2)
self.container = None
else:
self.container = container.upper()

if codename is not None:
valid_codename = ["Swiftest", "Swifter", "Swift"]
if codename.title() not in valid_codename:
Expand All @@ -960,13 +941,7 @@ def set_integrator(self,
self.param['! VERSION'] = f"{self.codename} input file"
update_list.append("codename")
if self.codename == "Swiftest":
if self.container is None:
self.binary_source = Path(_pyfile).parent.parent.parent.parent / "bin" / "swiftest_driver"
elif self.container == "DOCKER":
self.binary_source = Path(_pyfile).parent.parent.parent.parent / "docker" / "bin" / "swiftest_driver"
elif self.container == "SINGULARITY":
self.binary_source = Path(_pyfile).parent.parent.parent.parent / "singularity" / "bin" / "swiftest_driver"

self.binary_source = Path(_pyfile).parent.parent.parent.parent / "bin" / "swiftest_driver"
self.binary_path = self.simdir.resolve()
self.driver_executable = self.binary_path / "swiftest_driver"
if not self.binary_source.exists():
Expand Down Expand Up @@ -1041,8 +1016,8 @@ def get_integrator(self,arg_list: str | List[str] | None = None, verbose: bool |
valid_instance_vars = {"codename": self.codename,
"integrator": self.integrator,
"param_file": str(self.param_file),
"driver_executable": str(self.driver_executable),
"container": self.container}
"driver_executable": str(self.driver_executable)
}

try:
self.integrator
Expand Down

0 comments on commit 6cce4f0

Please sign in to comment.