Skip to content

Commit d237832

Browse files
committed
ok
1 parent d44f19b commit d237832

File tree

2 files changed

+13
-5
lines changed
  • services/dask-sidecar/src/simcore_service_dask_sidecar

2 files changed

+13
-5
lines changed

services/dask-sidecar/src/simcore_service_dask_sidecar/computational_sidecar/core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
from .task_shared_volume import TaskSharedVolumes
5050

5151
_logger = logging.getLogger(__name__)
52-
CONTAINER_WAIT_TIME_SECS = 2
53-
MAX_LOGGED_FILE_CHARS = 40
52+
_CONTAINER_WAIT_TIME_SECS = 2
53+
_MAX_LOGGED_FILE_CHARS = 40
5454

5555

5656
@dataclass(kw_only=True, frozen=True, slots=True)
@@ -154,7 +154,10 @@ async def _retrieve_output_data(
154154

155155
src_path = task_volumes.outputs_folder / output_params.file_mapping
156156
await log_partial_file_content(
157-
src_path, _logger, MAX_LOGGED_FILE_CHARS
157+
src_path,
158+
logger=_logger,
159+
log_level=logging.DEBUG,
160+
max_chars=_MAX_LOGGED_FILE_CHARS,
158161
)
159162
upload_tasks.append(
160163
push_file_to_remote(
@@ -271,7 +274,7 @@ async def run(self, command: list[str]) -> TaskOutputData:
271274
)
272275
# wait until the container finished, either success or fail or timeout
273276
while (container_data := await container.show())["State"]["Running"]:
274-
await asyncio.sleep(CONTAINER_WAIT_TIME_SECS)
277+
await asyncio.sleep(_CONTAINER_WAIT_TIME_SECS)
275278
if container_data["State"]["ExitCode"] > os.EX_OK:
276279
raise ServiceRuntimeError(
277280
service_key=self.task_parameters.image,

services/dask-sidecar/src/simcore_service_dask_sidecar/utils/files.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,13 @@ async def push_file_to_remote(
333333

334334

335335
async def log_partial_file_content(
336-
src_path: Path, logger: logging.Logger, log_level: int, max_chars: int
336+
src_path: Path, *, logger: logging.Logger, log_level: int, max_chars: int
337337
) -> None:
338+
if max_chars < 0:
339+
msg = "max_chars must be non-negative"
340+
raise ValueError(msg)
341+
if max_chars == 0:
342+
return
338343
if not src_path.exists():
339344
logger.log(log_level, "file does not exist: %s", src_path)
340345
return

0 commit comments

Comments
 (0)