(job_id, companies: list[str], positions: list[str])
| 22 | |
| 23 | |
| 24 | def kickoff_crew(job_id, companies: list[str], positions: list[str]): |
| 25 | logger.info(f"Crew for job {job_id} is starting") |
| 26 | |
| 27 | results = None |
| 28 | try: |
| 29 | company_research_crew = CompanyResearchCrew(job_id) |
| 30 | company_research_crew.setup_crew( |
| 31 | companies, positions) |
| 32 | results = company_research_crew.kickoff() |
| 33 | logger.info(f"Crew for job {job_id} is complete", results) |
| 34 | |
| 35 | except Exception as e: |
| 36 | logger.error(f"Error in kickoff_crew for job {job_id}: {e}") |
| 37 | append_event(job_id, f"An error occurred: {e}") |
| 38 | with jobs_lock: |
| 39 | jobs[job_id].status = 'ERROR' |
| 40 | jobs[job_id].result = str(e) |
| 41 | |
| 42 | with jobs_lock: |
| 43 | jobs[job_id].status = 'COMPLETE' |
| 44 | jobs[job_id].result = results |
| 45 | jobs[job_id].events.append( |
| 46 | Event(timestamp=datetime.now(), data="Crew complete")) |
| 47 | |
| 48 | |
| 49 | @app.route('/api/crew', methods=['POST']) |
nothing calls this directly
no test coverage detected