Skip to content

Commit

Permalink
add option to start the gRPC connections without secret keys and add … (
Browse files Browse the repository at this point in the history
  • Loading branch information
mariostieriansys committed Aug 22, 2023
1 parent be991d8 commit b91c135
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ansys/pyensight/core/locallauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def start(self) -> "pyensight.Session":
# Launch EnSight
# create the environmental variables
local_env = os.environ.copy()
local_env["ENSIGHT_SECURITY_TOKEN"] = self._secret_key
if not local_env.get("ENSIGHT_GRPC_DISABLE_SECURITY_TOKEN"):
local_env["ENSIGHT_SECURITY_TOKEN"] = self._secret_key
local_env["WEBSOCKETSERVER_SECURITY_TOKEN"] = self._secret_key
local_env["ENSIGHT_SESSION_TEMPDIR"] = self.session_directory
# If for some reason, the ENSIGHT_ANSYS_LAUNCH is set previously,
Expand Down
11 changes: 10 additions & 1 deletion src/ansys/pyensight/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,10 @@ def _build_utils_interface(self) -> None:
# Warn on import errors
print(f"Error loading ensight.utils from: '{_filename}' : {e}")

MONITOR_NEW_TIMESTEPS_OFF = "off"
MONITOR_NEW_TIMESTEPS_STAY_AT_CURRENT = "stay_at_current"
MONITOR_NEW_TIMESTEPS_JUMP_TO_END = "jump_to_end"

def load_data(
self,
data_file: str,
Expand All @@ -970,6 +974,7 @@ def load_data(
reader_options: Optional[dict] = None,
new_case: bool = False,
representation: str = "3D_feature_2D_full",
monitor_new_timesteps: str = MONITOR_NEW_TIMESTEPS_OFF,
) -> None:
"""Load a dataset into the EnSight instance.
Expand All @@ -995,6 +1000,10 @@ def load_data(
representation : str, optional
Default representation for the parts loaded. The default is
``"3D_feature_2D_full"``.
monitor_new_timesteps: str, optional
Defaulted to off, if changed EnSight will monitor for new timesteps.
The allowed values are MONITOR_NEW_TIMESTEPS_OFF, MONITOR_NEW_TIMESTEPS_STAY_AT_CURRENT
and MONITOR_NEW_TIMESTEPS_JUMP_TO_END
Raises
------
Expand Down Expand Up @@ -1074,7 +1083,7 @@ def load_data(
if result_file:
cmds.append(f'ensight.data.result(r"""{result_file}""")')
cmds.append("ensight.data.shift_time(1.000000, 0.000000, 0.000000)")
cmds.append('ensight.solution_time.monitor_for_new_steps("off")')
cmds.append(f'ensight.solution_time.monitor_for_new_steps("{monitor_new_timesteps}")')
cmds.append(f'ensight.data.replace(r"""{data_file}""")')
for cmd in cmds:
if self.cmd(cmd) != 0:
Expand Down

0 comments on commit b91c135

Please sign in to comment.