Spaces:
Sleeping
Sleeping
File size: 1,220 Bytes
c01955c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from src.CodeRunAndModelTrain.components.job_fetcher import JobFetcher
from src.CodeRunAndModelTrain.utils.Abstract import Pipeline
from src.CodeRunAndModelTrain.entity.config_entity import JobFetcherConfig
from utils.asyncHandler import asyncHandler
import os
import logging
class JobFetcherPipeline(Pipeline):
def __init__(self):
super().__init__()
self.job_fetcher_config = JobFetcherConfig()
self.job_fetcher = JobFetcher(job_fetcher_config=self.job_fetcher_config)
@asyncHandler
async def initiate(self, jobtile: str="Machine Learning",updated:bool=False):
print("received",jobtile,updated)
if not updated and os.path.exists(os.path.join("artifact","jobs",jobtile+".csv")):
logging.info("loading jobs from the saved file")
self.job_fetcher_config.saved_jobs_file_path=os.path.join("artifact","jobs",jobtile+".csv")
return self.job_fetcher_config
logging.info("Entered in the initiate JobFetcherPipeline method")
result = await self.job_fetcher.fetch(jobtile=jobtile)
logging.info("jobFetcher execution completed")
logging.info("Exiting from JobFetcherPipeline method")
return result
|