Repository: mosaicml/composer (branch: add-memory-snapshot)
Commit date: 2023-12-19T00:14:34Z

Workflow file: .github/workflows/code-quality.yaml (Code Quality Checks)
name: Code Quality Checks
on:
  push:
    branches:
      - dev
      - main
      - release/**
  pull_request:
  workflow_call:
  workflow_dispatch:
# Cancel old runs when a new commit is pushed to the same branch if not on main or dev
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
defaults:
  run:
    working-directory: .
jobs:
  code-quality:
    runs-on: ubuntu-20.04
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    timeout-minutes: 10
    strategy:
      matrix:
        python_version:
          - "3.8"
          - "3.9"
          - "3.10"
        pip_deps:
          - "[dev]"
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python_version }}
      - name: Setup
        run: |
          set -ex
          python -m pip install --upgrade 'pip<23' wheel
          python -m pip install --upgrade .${{ matrix.pip_deps }}
      - name: Run checks
        run: |
          pre-commit run --all-files

env:
  PIP_INDEX_URL: http://localhost:8629/2023-12-19
  UV_INDEX_URL: http://localhost:8629/2023-12-19


Failed build logs:
step_name: code-quality (3.10, [dev])/5_Run checks.txt
log: ##[group]Run pre-commit run --all-files
[36;1mpre-commit run --all-files[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib
##[endgroup]
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/google/yapf.
[INFO] Initializing environment for https://github.com/google/yapf:toml.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle.
[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle:toml.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/kynan/nbstripout.
[INFO] Initializing environment for local:pyright@1.1.256.
[INFO] Initializing environment for https://github.com/trufflesecurity/trufflehog.git.
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/google/yapf.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/PyCQA/pydocstyle.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/kynan/nbstripout.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/trufflesecurity/trufflehog.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
ruff.....................................................................Passed
yapf.....................................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /home/runner/work/composer/composer/composer/callbacks/__init__.py
Fixing /home/runner/work/composer/composer/tests/callbacks/test_memory_snapshot.py

pydocstyle...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
check builtin type constructor use.......................................Passed
check for case conflicts.................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.....................................Passed
check json...............................................................Passed
check that scripts with shebangs are executable..........................Passed
pretty format json.......................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks................................................Passed
check toml...............................................................Passed
check vcs permalinks.....................................................Passed
check xml................................................................Passed
check yaml...............................................................Passed
debug statements (python)................................................Passed
detect destroyed symlinks................................................Passed
fix double quoted strings................................................Passed
fix end of files.........................................................Passed
fix utf-8 byte order marker..............................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Insert license in comments...............................................Passed
nbstripout...............................................................Passed
pyright..................................................................Passed
secret scan..............................................................Passed
##[error]Process completed with exit code 1.


Changed files:
composer/callbacks/__init__.py
tests/callbacks/test_memory_snapshot.py

Fix diff:
diff --git a/composer/callbacks/__init__.py b/composer/callbacks/__init__.py
index d8dcd31b..268786a6 100644
--- a/composer/callbacks/__init__.py
+++ b/composer/callbacks/__init__.py
@@ -16,6 +16,7 @@ from composer.callbacks.health_checker import HealthChecker
 from composer.callbacks.image_visualizer import ImageVisualizer
 from composer.callbacks.lr_monitor import LRMonitor
 from composer.callbacks.memory_monitor import MemoryMonitor
+from composer.callbacks.memory_snapshot import MemorySnapshot
 from composer.callbacks.mlperf import MLPerfCallback
 from composer.callbacks.nan_monitor import NaNMonitor
 from composer.callbacks.optimizer_monitor import OptimizerMonitor
@@ -23,7 +24,6 @@ from composer.callbacks.runtime_estimator import RuntimeEstimator
 from composer.callbacks.speed_monitor import SpeedMonitor
 from composer.callbacks.system_metrics_monitor import SystemMetricsMonitor
 from composer.callbacks.threshold_stopper import ThresholdStopper
-from composer.callbacks.memory_snapshot import MemorySnapshot
 
 __all__ = [
     'ActivationMonitor',
diff --git a/tests/callbacks/test_memory_snapshot.py b/tests/callbacks/test_memory_snapshot.py
index a868778a..a78fab2c 100644
--- a/tests/callbacks/test_memory_snapshot.py
+++ b/tests/callbacks/test_memory_snapshot.py
@@ -1,15 +1,16 @@
 # Copyright 2022 MosaicML Composer authors
 # SPDX-License-Identifier: Apache-2.0
 
+import pathlib
+
 import pytest
 from torch.utils.data import DataLoader
-import pathlib
 
+from composer import State, Trainer
 from composer.callbacks import MemorySnapshot
+from composer.loggers import LoggerDestination
 from composer.trainer import Trainer
 from tests.common import RandomClassificationDataset, SimpleModel
-from composer.loggers import LoggerDestination
-from composer import State, Trainer
 
 
 class FileUploaderTracker(LoggerDestination):