Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated MediaManager #1262

Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/openvinotoolkit/datumaro/pull/1251>)
- Add default value for target in prune cli
(<https://github.com/openvinotoolkit/datumaro/pull/1253>)
- Remove deprecated MediaManager
(<https://github.com/openvinotoolkit/datumaro/pull/1262>)

## Jan. 2024 Release 1.5.2
### Enhancements
Expand Down
1 change: 0 additions & 1 deletion src/datumaro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
from .components.importer import FailingImportErrorPolicy, Importer, ImportErrorPolicy
from .components.launcher import Launcher
from .components.media import Image, MediaElement, Video, VideoFrame
from .components.media_manager import MediaManager
from .components.progress_reporting import (
NullProgressReporter,
ProgressReporter,
Expand Down
5 changes: 0 additions & 5 deletions src/datumaro/components/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
import os.path as osp
import shutil
import weakref
from copy import deepcopy
from enum import IntEnum
from typing import (
Expand Down Expand Up @@ -603,10 +602,6 @@ def __init__(
self._frame_count = None
self._length = None

from .media_manager import MediaManager

MediaManager.get_instance().push(weakref.ref(self), self)

def close(self):
self._iterator = None

Expand Down
81 changes: 0 additions & 81 deletions src/datumaro/components/media_manager.py

This file was deleted.

11 changes: 0 additions & 11 deletions src/datumaro/components/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
VcsError,
)
from datumaro.components.launcher import Launcher
from datumaro.components.media_manager import MediaManager
from datumaro.util import find, parse_json_file, parse_str_enum_value
from datumaro.util.log_utils import catch_logs, logging_disabled
from datumaro.util.os_util import (
Expand Down Expand Up @@ -1812,8 +1811,6 @@ def init(cls, path) -> Project:
return project

def close(self):
MediaManager.get_instance().clear()

if self._dvc:
self._dvc.close()
self._dvc = None
Expand Down Expand Up @@ -2012,8 +2009,6 @@ def remove_cache_obj(self, ref: Union[Revision, ObjectId]):
if self.readonly:
raise ReadonlyProjectError()

MediaManager.get_instance().clear()

obj_type, obj_hash = self._parse_ref(ref)

if self._is_cached(obj_hash):
Expand Down Expand Up @@ -2364,8 +2359,6 @@ def remove_source(self, name: str, *, force: bool = False, keep_data: bool = Tru
if name not in self.working_tree.sources and not force:
raise UnknownSourceError(name)

MediaManager.get_instance().clear()

self.working_tree.sources.remove(name)

data_dir = self.source_data_dir(name)
Expand Down Expand Up @@ -2502,8 +2495,6 @@ def checkout(

rev = rev or "HEAD"

MediaManager.get_instance().clear()

if sources:
rev_tree = self.get_rev(rev)

Expand Down Expand Up @@ -2714,8 +2705,6 @@ def remove_model(self, name: str):
if name not in self.models:
raise KeyError("Unknown model '%s'" % name)

MediaManager.get_instance().clear()

self._config.models.remove(name)

data_dir = self.model_data_dir(name)
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/cli/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import numpy as np
import pytest

from datumaro.components.media_manager import MediaManager
from datumaro.util.scope import on_exit_do, scope_add, scoped

from ...requirements import Requirements, mark_requirement
Expand All @@ -22,7 +21,6 @@ class VideoSplittingTest:
@patch("datumaro.components.media.VideoFrame.data", new_callable=PropertyMock)
def test_can_split_video(self, mock_video_frame_data):
mock_video_frame_data.return_value = np.full((32, 32, 3), fill_value=0, dtype=np.uint8)
on_exit_do(MediaManager.get_instance().clear)

test_dir = scope_add(TestDir())
video_path = osp.join(test_dir, "video.avi")
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from datumaro.components.dataset import Dataset
from datumaro.components.dataset_base import DatasetItem
from datumaro.components.media import Image, Video, VideoFrame
from datumaro.components.media_manager import MediaManager
from datumaro.components.project import Project
from datumaro.util.scope import Scope, on_exit_do, scope_add, scoped

Expand Down Expand Up @@ -122,8 +121,6 @@ class VideoExtractorTest:
@mark_requirement(Requirements.DATUM_GENERAL_REQ)
@scoped
def test_can_read_frames(self, fxt_sample_video):
on_exit_do(MediaManager.get_instance().clear)

expected = Dataset.from_iterable(
[
DatasetItem(
Expand All @@ -145,7 +142,6 @@ def test_can_read_frames(self, fxt_sample_video):
@scoped
def test_can_split_and_load(self, fxt_sample_video):
test_dir = scope_add(TestDir())
on_exit_do(MediaManager.get_instance().clear)

expected = Dataset.from_iterable(
[
Expand Down
Loading