Skip to content

Conversation

utotsubasa
Copy link
Contributor

@utotsubasa utotsubasa commented Feb 12, 2025

TBE

utotsubasa and others added 17 commits February 10, 2025 16:57
feat: last_modification_time feature in `InMemoryTarget`
style: add some type hints
fix: fix typo in `InMemoryCacheRepository`
test: add some tests for `InMemoryTarget` and `InMemoryCacheRepository`
style: update variable name from `id` to `key`
chore: add type hints
style: remove `Protocol`
feat: add the new parameter `cache_in_memory_by_default` to switch default Target
style: update the variable name from `target_key` to `data_key` for code consistency
test: add tests for `TaskOnKart`s with the `cache_in_memory` parameter
@utotsubasa utotsubasa force-pushed the feat/in_memory_parameter_on_task branch from fa0cbd3 to 76cb255 Compare February 13, 2025 06:23
@utotsubasa utotsubasa changed the title Feat: in memory parameter on task Feat: Create InMemoryTarget from TargetOnKart Feb 17, 2025
@utotsubasa utotsubasa changed the title Feat: Create InMemoryTarget from TargetOnKart Feat: Create InMemoryTarget from TaskOnKart Feb 17, 2025
@utotsubasa utotsubasa marked this pull request as ready for review February 19, 2025 06:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the InMemoryTarget functionality to TaskOnKart by adding a new parameter (cache_in_memory_by_default) that allows tasks to store outputs in memory rather than on file by default. It also updates tests to confirm correct target creation and behavior and refactors target creation functions for better clarity.

  • Added cache_in_memory_by_default parameter and associated methods in TaskOnKart.
  • Updated test files to verify that cache targets and file targets are created as expected.
  • Refactored make_in_memory_target in the InMemoryTarget module to support an optional unique id.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
test/in_memory/test_task_cached_in_memory.py Added tests to verify in-memory caching behavior and target paths.
test/in_memory/test_in_memory_target.py Updated fixture to use data_key to create in-memory targets.
gokart/task.py Introduced cache_in_memory_by_default parameter and logic for default targets.
gokart/in_memory/target.py Refactored make_in_memory_target; added helper _make_data_key.
Comments suppressed due to low confidence (1)

gokart/in_memory/target.py:43

  • Typo in the TODO comment: 'migit' should be corrected to 'might'.
# TODO: this module name `_path` migit not be appropriate

Copy link
Member

@kitagry kitagry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review 🙏

def input(self) -> FlattenableItems[TargetOnKart]:
return super().input()

def output(self) -> FlattenableItems[TargetOnKart]:
return self.make_target()
return self.make_default_target()
Copy link
Member

@kitagry kitagry May 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to change here instead of overwriting a method.

Suggested change
return self.make_default_target()
return self.make_target if not self.cache_in_memory_by_default()else self.make_cache_target()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants