From 4e72b8c9867579412b4f5f80d289f0877614d4b9 Mon Sep 17 00:00:00 2001 From: ashwani yadav <22ashwaniyadav@gmail.com> Date: Wed, 8 Jul 2026 02:07:32 +0530 Subject: [PATCH] api: Add error logging for silenced ES exceptions --- openml_OS/libraries/ElasticSearch.php | 4 ++-- openml_OS/models/api/v1/Api_data.php | 2 +- openml_OS/models/api/v1/Api_flow.php | 4 ++-- openml_OS/models/api/v1/Api_run.php | 2 +- openml_OS/models/api/v1/Api_study.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openml_OS/libraries/ElasticSearch.php b/openml_OS/libraries/ElasticSearch.php index 986290733..61a654155 100644 --- a/openml_OS/libraries/ElasticSearch.php +++ b/openml_OS/libraries/ElasticSearch.php @@ -331,7 +331,7 @@ public function index($type, $id = false, $altmetrics=True, $verbosity=0) { return $this->$method_name($id, $altmetrics, $verbosity); } catch (Exception $e) { echo $e->getMessage(); - // TODO: log? + log_message('error', '[ElasticSearch] Indexing failed for type ' . $type . ' (id: ' . ($id ?: 'all') . '): ' . $e->getMessage()); } } else { return 'No function exists to build index of type ' . $type; @@ -352,7 +352,7 @@ public function index_from($type, $id = false, $verbosity=1, $altmetrics=False) return $this->$method_name(false, $id, $altmetrics, $verbosity); } catch (Exception $e) { echo $e->getMessage(); - // TODO: log? + log_message('error', '[ElasticSearch] Indexing from id failed for type ' . $type . ' (from id: ' . ($id ?: '0') . '): ' . $e->getMessage()); } } else { return 'No function exists to build index of type ' . $type; diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index 8e5444fb2..39318fadf 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -1306,7 +1306,7 @@ private function data_upload() { // update counters $this->elasticsearch->index('user', $this->user_id); } catch (Exception $e) { - // TODO: should log + log_message('error', '[Api_data] ElasticSearch indexing failed for data id ' . $id . ': ' . $e->getMessage()); } // insert tags. This relies on the ES record to exist. diff --git a/openml_OS/models/api/v1/Api_flow.php b/openml_OS/models/api/v1/Api_flow.php index e75441fdb..004496968 100644 --- a/openml_OS/models/api/v1/Api_flow.php +++ b/openml_OS/models/api/v1/Api_flow.php @@ -655,7 +655,7 @@ private function flow_upload() { // update counters $this->elasticsearch->index('user', $this->user_id); } catch (Exception $e) { - // TODO: should be logged + log_message('error', '[Api_flow] ElasticSearch indexing failed for flow id ' . $impl . ': ' . $e->getMessage()); } $this->xmlContents( 'implementation-upload', $this->version, $implementation ); @@ -855,7 +855,7 @@ private function insertImplementationFromXML( $xml, $configuration, $implementat try { $this->elasticsearch->index('flow', $flow_id); } catch (Exception $e) { - // TODO should be logged + log_message('error', '[Api_flow] ElasticSearch indexing failed for flow id ' . $flow_id . ': ' . $e->getMessage()); } diff --git a/openml_OS/models/api/v1/Api_run.php b/openml_OS/models/api/v1/Api_run.php index a1f4bb759..db42933d9 100644 --- a/openml_OS/models/api/v1/Api_run.php +++ b/openml_OS/models/api/v1/Api_run.php @@ -1022,7 +1022,7 @@ private function run_upload() { try { $this->elasticsearch->index('run', $runId); } catch (Exception $e) { - // TODO: should log + log_message('error', '[Api_run] ElasticSearch indexing failed for run id ' . $runId . ': ' . $e->getMessage()); } $timestamps[] = microtime(true); // profiling 4 diff --git a/openml_OS/models/api/v1/Api_study.php b/openml_OS/models/api/v1/Api_study.php index b5261b229..3944d8d59 100644 --- a/openml_OS/models/api/v1/Api_study.php +++ b/openml_OS/models/api/v1/Api_study.php @@ -210,7 +210,7 @@ private function study_create() { // update counters $this->elasticsearch->index('user', $this->user_id); } catch (Exception $e) { - // TODO: should log + log_message('error', '[Api_study] ElasticSearch indexing failed for study id ' . $study_id . ': ' . $e->getMessage()); } $this->xmlContents('study-upload', $this->version, array('study_id' => $study_id));