Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ env:
PACKAGE_NAME: 'ansys-fluent-core'
PACKAGE_NAMESPACE: 'ansys.fluent.core'
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/nightly-dev-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ env:
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'
DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:
nightly_docs_build:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/nightly-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ on:

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:
test:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ env:
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'
DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:
nightly_docs_build:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/run-custom-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ concurrency:

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-run-wo-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ on:

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1

jobs:
test:
Expand Down
13 changes: 7 additions & 6 deletions codegen/tuigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ def generate():
_populate_xml_helpstrings()
TUIGenerator("meshing", version).generate()
TUIGenerator("solver", version).generate()
logger.info(
"XML help is available but not picked for the following %i paths:",
len(_XML_HELPSTRINGS),
)
for k, _ in _XML_HELPSTRINGS.items():
logger.info(k)
if os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
logger.info(
"XML help is available but not picked for the following %i paths: ",
len(_XML_HELPSTRINGS),
)
for k in _XML_HELPSTRINGS:
logger.info(k)


if __name__ == "__main__":
Expand Down
29 changes: 26 additions & 3 deletions src/ansys/fluent/core/launcher/fluent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,17 @@ def configure_container_dict(
``container_dict``, see `Docker run documentation`_.
"""

logger.debug(f"container_dict before processing: {container_dict}")
if (
container_dict
and "environment" in container_dict
and os.getenv("PYFLUENT_HIDE_LOG_SECRETS") == "1"
):
container_dict_h = container_dict.copy()
container_dict_h.pop("environment")
logger.debug(f"container_dict before processing: {container_dict_h}")
del container_dict_h
else:
logger.debug(f"container_dict before processing: {container_dict}")

if not host_mount_path:
host_mount_path = pyfluent.EXAMPLES_PATH
Expand Down Expand Up @@ -302,8 +312,6 @@ def start_fluent_container(args: List[str], container_dict: dict = None) -> (int

container_vars = configure_container_dict(args, **container_dict)

logger.debug(f"container_vars:{container_vars}")

(
config_dict,
timeout,
Expand All @@ -312,6 +320,21 @@ def start_fluent_container(args: List[str], container_dict: dict = None) -> (int
remove_server_info_file,
) = container_vars

if os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
logger.debug(f"container_vars: {container_vars}")
else:
config_dict_h = config_dict.copy()
config_dict_h.pop("environment")
container_vars_tmp = (
config_dict_h,
timeout,
port,
host_server_info_file,
remove_server_info_file,
)
logger.debug(f"container_vars: {container_vars_tmp}")
del container_vars_tmp

try:
if not host_server_info_file.exists():
host_server_info_file.parents[0].mkdir(exist_ok=True)
Expand Down
8 changes: 7 additions & 1 deletion src/ansys/fluent/core/launcher/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,13 @@ def launch_fluent(

print("\nDocker container run configuration:\n")
print("config_dict = ")
pprint(config_dict)
if os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
pprint(config_dict)
else:
config_dict_h = config_dict.copy()
config_dict_h.pop("environment")
pprint(config_dict_h)
del config_dict_h
return config_dict

port, password = start_fluent_container(args, container_dict)
Expand Down
30 changes: 19 additions & 11 deletions src/ansys/fluent/core/services/interceptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@

network_logger = logging.getLogger("pyfluent.networking")
log_bytes_limit = int(os.getenv("PYFLUENT_GRPC_LOG_BYTES_LIMIT", 1000))
truncate_len = log_bytes_limit // 5


def _truncate_grpc_str(message):
message_bytes = message.ByteSize()
message_str = str(MessageToDict(message))
if not log_bytes_limit or message_bytes < log_bytes_limit:
return message_str
else:
network_logger.debug(
f"GRPC_TRACE: message partially hidden, {message_bytes} bytes > "
f"{log_bytes_limit} bytes limit. To see the full message, set PYFLUENT_GRPC_LOG_BYTES_LIMIT to 0."
)
return f"{message_str[:truncate_len]} < ... > {message_str[-truncate_len:]}"


class TracingInterceptor(grpc.UnaryUnaryClientInterceptor):
Expand All @@ -27,20 +41,14 @@ def _intercept_call(
request: Any,
):
network_logger.debug(
f"GRPC_TRACE: rpc = {client_call_details.method}, request = {MessageToDict(request)}"
f"GRPC_TRACE: rpc = {client_call_details.method}, request = {_truncate_grpc_str(request)}"
)
response = continuation(client_call_details, request)
if not response.exception():
response_bytes = response.result().ByteSize()
if not log_bytes_limit or response_bytes < log_bytes_limit:
network_logger.debug(
f"GRPC_TRACE: response = {MessageToDict(response.result())}"
)
else:
network_logger.debug(
f"GRPC_TRACE: response hidden, {response_bytes} bytes > "
f"{log_bytes_limit} bytes limit. To see the response, set PYFLUENT_GRPC_LOG_BYTES_LIMIT to 0."
)
# call _truncate_grpc_str early to get the size warning even when hiding secrets
response_str = _truncate_grpc_str(response.result())
if os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
network_logger.debug(f"GRPC_TRACE: response = {response_str}")
return response

def intercept_unary_unary(
Expand Down