-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add acquisition use case #112
Open
Arthemide
wants to merge
8
commits into
main
Choose a base branch
from
add-acquisition-use-case
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f800e37
make item_rule_config optional
1541e90
add data gathering use case
b5ab529
change file organization
590b2c5
lint
5ff0755
fix tests
49e4d35
remove recreate_me on config
a503c25
review
e2e5161
fix functional tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
edge_orchestrator/config/data_gathering_with_2_fake_cam.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"station_name": "data_gathering_with_2_fake_cam", | ||
"camera_configs": { | ||
"camera_1": { | ||
"camera_id": "camera_1", | ||
"camera_type": "fake", | ||
"source_directory": "fake_images/marker_images", | ||
"position": "front" | ||
}, | ||
"camera_2": { | ||
"camera_id": "camera_2", | ||
"camera_type": "fake", | ||
"source_directory": "fake_images/marker_images", | ||
"position": "front" | ||
} | ||
}, | ||
"binary_storage_config": { | ||
"storage_type": "gcp" | ||
}, | ||
"metadata_storage_config": { | ||
"storage_type": "gcp" | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
edge_orchestrator/src/edge_orchestrator/application/use_cases/data_gathering.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import logging | ||
|
||
from edge_orchestrator.domain.models.item import Item | ||
from edge_orchestrator.domain.models.station_config import StationConfig | ||
from edge_orchestrator.domain.ports.binary_storage.i_binary_storage_factory import ( | ||
IBinaryStorageFactory, | ||
) | ||
from edge_orchestrator.domain.ports.binary_storage.i_binary_storage_manager import ( | ||
IBinaryStorageManager, | ||
) | ||
from edge_orchestrator.domain.ports.camera.i_camera_manager import ICameraManager | ||
from edge_orchestrator.domain.ports.metadata_storage.i_metadata_storage_factory import ( | ||
IMetadataStorageFactory, | ||
) | ||
from edge_orchestrator.domain.ports.metadata_storage.i_metadata_storage_manager import ( | ||
IMetadataStorageManager, | ||
) | ||
from edge_orchestrator.utils.singleton import SingletonMeta | ||
|
||
|
||
class DataGathering(metaclass=SingletonMeta): | ||
def __init__( | ||
self, | ||
metadata_storage_manager: IMetadataStorageManager, | ||
binary_storage_manager: IBinaryStorageManager, | ||
camera_manager: ICameraManager, | ||
): | ||
self._logger = logging.getLogger(__name__) | ||
self._metadata_storage_manager = metadata_storage_manager | ||
self._binary_storage_manager = binary_storage_manager | ||
self._camera_manager = camera_manager | ||
|
||
async def acquire(self, item: Item, station_config: StationConfig): | ||
self._camera_manager.create_cameras(station_config) | ||
self._camera_manager.take_pictures(item) | ||
|
||
self._binary_storage_manager.get_binary_storage(station_config).save_item_binaries(item) | ||
|
||
self._metadata_storage_manager.get_metadata_storage(station_config).save_item_metadata(item) | ||
|
||
def reset_managers( | ||
self, binary_storage_factory: IBinaryStorageFactory, metadata_storage_factory: IMetadataStorageFactory | ||
): | ||
self._logger.info("Resetting all managers after configuration update...") | ||
self._metadata_storage_manager.reset(metadata_storage_factory) | ||
self._binary_storage_manager.reset(binary_storage_factory) | ||
self._camera_manager.reset() | ||
self._logger.info("Managers reset done!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je réfléchissais l'autre jour à cette histoire de singleton, je ne sais pas si c'est le mieux mais bon ça marche à condition que tu mettes une méthode de reset en cas de changement de config > regarde là
VIO/edge_orchestrator/src/edge_orchestrator/interface/api/dependency_injection.py
Line 154 in 8f33293