Skip to content

Commit

Permalink
Refactor Notebook.js and SparkModel.js for improved Spark app ID hand…
Browse files Browse the repository at this point in the history
…ling

- Updated Notebook.js to extract and store Spark app ID more efficiently, ensuring it is only stored if valid.
- Enhanced logging to provide clearer visibility of the extracted Spark app ID.
- Added a console log in SparkModel.js to confirm successful extraction of the Spark app ID, improving debugging capabilities.
  • Loading branch information
xuwenyihust committed Dec 10, 2024
1 parent 5d1bfce commit ef385eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions webapp/src/components/notebook/Notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,13 @@ function Notebook({

// Check if contains a spark app id
if (result[0] && result[0].data && result[0].data['text/html'] && SparkModel.isSparkInfo(result[0].data['text/html'])) {
setSparkAppId(SparkModel.extractSparkAppId(result[0].data['text/html']));
SparkModel.storeSparkInfo(sparkAppId, notebook.path)
const appId = SparkModel.extractSparkAppId(result[0].data['text/html']);
setSparkAppId(appId);
if (appId) {
SparkModel.storeSparkInfo(appId, notebook.path);
}
}
console.log('Spark app id:', sparkAppId);
console.log('Spark app id:', appId);

} catch (error) {
console.error('Failed to execute cell:', error);
Expand Down
1 change: 1 addition & 0 deletions webapp/src/models/SparkModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class SparkModel {
if (!appIdTag) return null;

const appId = appIdTag.textContent.split(': ')[1];
console.log('Extracted Spark app ID:', appId);
return appId && appId.startsWith('app-') ? appId : null;
}

Expand Down

0 comments on commit ef385eb

Please sign in to comment.