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 adding task in algorithm creation #398

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
9 changes: 0 additions & 9 deletions amt/services/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from amt.schema.system_card import AiActProfile, SystemCard
from amt.services.instruments import InstrumentsService, create_instrument_service
from amt.services.task_registry import get_requirements_and_measures
from amt.services.tasks import TasksService

logger = logging.getLogger(__name__)

Expand All @@ -28,12 +27,10 @@ class AlgorithmsService:
def __init__(
self,
repository: Annotated[AlgorithmsRepository, Depends(AlgorithmsRepository)],
task_service: Annotated[TasksService, Depends(TasksService)],
instrument_service: Annotated[InstrumentsService, Depends(create_instrument_service)],
) -> None:
self.repository = repository
self.instrument_service = instrument_service
self.task_service = task_service

async def get(self, algorithm_id: int) -> Algorithm:
algorithm = await self.repository.find_by_id(algorithm_id)
Expand Down Expand Up @@ -103,12 +100,6 @@ async def create(self, algorithm_new: AlgorithmNew) -> Algorithm:
algorithm = Algorithm(name=algorithm_new.name, lifecycle=algorithm_new.lifecycle, system_card=system_card)
algorithm = await self.update(algorithm)

selected_instruments = await self.instrument_service.fetch_instruments(
[instrument.urn for instrument in algorithm.system_card.instruments]
)
for instrument in selected_instruments:
await self.task_service.create_instrument_tasks(instrument.tasks, algorithm)

return algorithm

async def paginate(
Expand Down
Loading
Loading