Skip to content

Commit

Permalink
code optimised
Browse files Browse the repository at this point in the history
  • Loading branch information
saranyaloganathan23 committed Aug 12, 2024
1 parent a2feabb commit 0730417
Showing 1 changed file with 21 additions and 44 deletions.
65 changes: 21 additions & 44 deletions src/jobs/submitJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -495,50 +495,27 @@ function SubmitJob({
jarFileSelected: string[] | string,
argumentSelected: string[] | string
) => {
if(mainClassSelected.includes('.jar')){
return {
sparkJob: {
mainJarFileUri: mainClassSelected,
...(propertyObject && {
properties: propertyObject
}),
...(archieveFileSelected !== '' && {
archiveUris: archieveFileSelected
}),
...(fileSelected !== '' && {
fileUris: [fileSelected]
}),
...(jarFileSelected !== '' && {
jarFileUris: jarFileSelected
}),
...(argumentSelected !== '' && {
args: argumentSelected
})
}
};
}
else{
return {
sparkJob: {
mainClass: mainClassSelected,
...(propertyObject && {
properties: propertyObject
}),
...(archieveFileSelected !== '' && {
archiveUris: archieveFileSelected
}),
...(fileSelected !== '' && {
fileUris: [fileSelected]
}),
...(jarFileSelected !== '' && {
jarFileUris: jarFileSelected
}),
...(argumentSelected !== '' && {
args: argumentSelected
})
}
};
}
const isJar = mainClassSelected.includes('.jar');
return {
sparkJob: {
...(isJar ? { mainJarFileUri: mainClassSelected } : { mainClass: mainClassSelected }),
...(propertyObject && {
properties: propertyObject
}),
...(archieveFileSelected !== '' && {
archiveUris: archieveFileSelected
}),
...(fileSelected !== '' && {
fileUris: [fileSelected]
}),
...(jarFileSelected !== '' && {
jarFileUris: jarFileSelected
}),
...(argumentSelected !== '' && {
args: argumentSelected
})
}
};
};

const createSparkRPayload = (
Expand Down

0 comments on commit 0730417

Please sign in to comment.