This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/fr/insee/trevas/lab Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 </parent >
1010 <groupId >fr.insee</groupId >
1111 <artifactId >trevas-lab</artifactId >
12- <version >1.0 .0</version >
12+ <version >1.1 .0</version >
1313 <name >Trevas Lab</name >
1414 <description >VTL API calling Trevas</description >
1515
Original file line number Diff line number Diff line change @@ -44,6 +44,19 @@ public class TrevasLabController {
4444 @ Autowired
4545 private ObjectMapper objectMapper ;
4646
47+ @ GetMapping ("check" )
48+ public ResponseEntity <String > check () {
49+ try (SparkSession sparkSession = sparkEngine .buildSparkSession ()) {
50+ if (sparkSession != null && !sparkSession .sparkContext ().isStopped ()) {
51+ return ResponseEntity .ok ("Spark Session is available and running." );
52+ } else {
53+ return ResponseEntity .status (500 ).body ("Spark Session is not available." );
54+ }
55+ } catch (Exception e ) {
56+ return ResponseEntity .status (500 ).body ("Error checking Spark Session: " + e .getMessage ());
57+ }
58+ }
59+
4760 @ PostMapping ("/connect" )
4861 public ResponseEntity <EditVisualize > getDataFromConnector (
4962 Authentication auth ,
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class SparkEngine {
3636 @ Autowired
3737 private ObjectMapper objectMapper ;
3838
39- private SparkSession buildSparkSession () {
39+ public SparkSession buildSparkSession () {
4040 SparkConf conf = Utils .loadSparkConfig (System .getenv ("SPARK_CONF_DIR" ));
4141 conf .set ("spark.driver.allowMultipleContexts" , "true" );
4242 // Note: all the dependencies are required for deserialization.
You can’t perform that action at this time.
0 commit comments