Skip to content

Commit

Permalink
Merge pull request #273 from dhanush-2397/dev
Browse files Browse the repository at this point in the history
Processor group added
  • Loading branch information
htvenkatesh authored Sep 14, 2023
2 parents 6fdb46c + 8beb696 commit b4ce8ff
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/ingestion/services/nvsk-api/nvsk-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export class NvskApiService {
.on('error', async (error) => {
const queryStr = await IngestionDatasetQuery.insertIntoEmission(pgname, url,jwtToken.split(' ')[1], error)
const result = await this.databaseService.executeQuery(queryStr.query, queryStr.values);

this.service.deleteLocalFile(fileName);
this.service.deleteLocalFile(fileName);
console.error('Error processing CSV:', error);
});
if((urlData?.indexOf(data) === urlData?.length -1) && (data.urls?.indexOf(url) === data.urls?.length - 1)){
Expand All @@ -123,18 +122,21 @@ export class NvskApiService {
async scheduleAdapters(){
try {
let url = `${process.env.SPEC_URL}` + '/schedule'

let scheduleBody = {
"processor_group_name": "Run_adapters",
"scheduled_at": " 0 */5 * * * ?"
}
let scheduleResult = await this.httpService.post(url, scheduleBody)
console.log('The schedule result is:',scheduleResult?.data['message']);
if (scheduleResult.status === 200) {
return { code: 200, message: scheduleResult?.['data']['message'] }
} else {
return { code: 400, error: "Adapter schedule failed" }
}
let processorGroups = ['Run_adapters','onestep_dataingestion_aws'];
for(let pgName of processorGroups){
let scheduleBody = {
"processor_group_name": `${pgName}`,
"scheduled_at": "0 */7 * * * ?"
}
console.log("The schedule is:", scheduleBody);
let scheduleResult = await this.httpService.post(url, scheduleBody)
console.log('The schedule result is:',scheduleResult?.data['message']);
if (scheduleResult.status === 200) {
return { code: 200, message: scheduleResult?.['data']['message'] }
} else {
return { code: 400, error: "Adapter schedule failed" }
}
}
} catch (err) {
console.log("error for adapters is:", err);
}
Expand Down

0 comments on commit b4ce8ff

Please sign in to comment.