Skip to content

Commit

Permalink
Remove adding task in algorithm creation (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherSpelt authored Nov 25, 2024
2 parents 983111f + 6dc9e17 commit a86c1ef
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 201 deletions.
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

0 comments on commit a86c1ef

Please sign in to comment.