Fix: issue-4220: Airflow throwing error while deploying ingestion dags to airflow (#4229)

This commit is contained in:
Shailesh Parmar 2022-04-19 19:17:20 +05:30 committed by GitHub
parent 0abe8f540b
commit dd2ccb1a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 11 deletions

View File

@ -11,7 +11,7 @@
* limitations under the License.
*/
import { isUndefined } from 'lodash';
import { isEmpty, isUndefined } from 'lodash';
import React, { useState } from 'react';
import {
INGESTION_SCHEDULER_INITIAL_VALUE,
@ -214,19 +214,23 @@ const AddIngestion = ({
const getFilterPatternData = (data: FilterPattern) => {
const { includes, excludes } = data;
return isUndefined(includes) && isUndefined(excludes)
? undefined
: {
const filterPattern =
(!isUndefined(includes) && includes.length) ||
(!isUndefined(excludes) && excludes.length)
? {
includes: includes && includes.length > 0 ? includes : undefined,
excludes: excludes && excludes.length > 0 ? excludes : undefined,
};
}
: undefined;
return filterPattern;
};
const createNewIngestion = () => {
const ingestionDetails: CreateIngestionPipeline = {
airflowConfig: {
startDate: startDate as unknown as Date,
endDate: endDate as unknown as Date,
endDate: isEmpty(endDate) ? undefined : (endDate as unknown as Date),
scheduleInterval: repeatFrequency,
forceDeploy: true,
},

View File

@ -55,6 +55,8 @@ const jsonData = {
'triggering-ingestion-error': 'Error while triggering ingestion workflow',
'deploy-ingestion-error': 'Error while deploying ingestion workflow!',
'fetch-auth-config-error': 'Error occurred while fetching auth configs!',
'fetch-chart-error': 'Error while fetching charts!',
'fetch-dashboard-details-error': 'Error while fetching dashboard details!',
@ -142,6 +144,7 @@ const jsonData = {
},
message: {
'no-services': 'No services',
'fail-to-deploy-pipeline': 'Failed to deploy Ingestion Pipeline',
},
};

View File

@ -22,6 +22,7 @@ import { ServiceCategory } from '../../enums/service.enum';
import { CreateIngestionPipeline } from '../../generated/api/services/ingestionPipelines/createIngestionPipeline';
import { DataObj } from '../../interface/service.interface';
import jsonData from '../../jsons/en';
import { getErrorText } from '../../utils/StringsUtils';
import { showErrorToast } from '../../utils/ToastUtils';
const AddServicePage = () => {
@ -66,11 +67,25 @@ const AddServicePage = () => {
}
})
.catch((err: AxiosError) => {
const errMessage = getErrorText(
err,
jsonData['api-error-messages']['create-ingestion-error']
);
if (
errMessage.includes(jsonData['message']['fail-to-deploy-pipeline'])
) {
showErrorToast(
errMessage,
jsonData['api-error-messages']['deploy-ingestion-error']
);
resolve();
} else {
showErrorToast(
err,
jsonData['api-error-messages']['create-ingestion-error']
);
reject();
}
});
});
};

View File

@ -420,10 +420,18 @@ const ServicePage: FunctionComponent = () => {
);
if (message.includes('Connection refused')) {
setConnectionAvailable(false);
} else if (
message.includes(jsonData['message']['fail-to-deploy-pipeline'])
) {
showErrorToast(
message,
jsonData['api-error-messages']['deploy-ingestion-error']
);
resolve();
} else {
showErrorToast(message);
}
reject();
}
});
});
};