SIENTIAPDE-1182

Enhance tests.ipynb and gates.py for improved logging and output clarity

- Set execution count to null in tests.ipynb for reproducibility.
- Added stdout output to tests.ipynb for better visibility of results.
- Updated DataFrame display logic in tests.ipynb to include additional print statements for length and size.
- Improved debug logging in gates.py to log prediction data as a string for better traceability.
- Changed info log in gates.py to use len() instead of size for consistency.
This commit is contained in:
vitor-aignosi
2025-09-04 09:51:58 -03:00
parent da21c128f8
commit 2e420dadba
2 changed files with 18 additions and 3 deletions

View File

@@ -409,6 +409,7 @@ class Gates(BaseActivity):
self.debug( self.debug(
f"Prediction store policy: {prediction_store_policy}", metadata) f"Prediction store policy: {prediction_store_policy}", metadata)
self.debug(f"Prediction data: {data.to_string()}", metadata)
policy_type, policy_value = self.get_prediction_store_policy( policy_type, policy_value = self.get_prediction_store_policy(
prediction_store_policy, metadata) prediction_store_policy, metadata)
@@ -442,7 +443,7 @@ class Gates(BaseActivity):
data = data.sort_values(by='timestamp', ascending=False) data = data.sort_values(by='timestamp', ascending=False)
data = data.reset_index(drop=True) data = data.reset_index(drop=True)
self.info(f"Prediction formatted: {data.size} rows", metadata) self.info(f"Prediction formatted: {len(data)} rows", metadata)
self.debug(f"Prediction data: {data.to_string()}", metadata) self.debug(f"Prediction data: {data.to_string()}", metadata)
return data.to_dict() return data.to_dict()

View File

@@ -332,7 +332,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"id": "e7c8eeb1", "id": "e7c8eeb1",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@@ -452,6 +452,14 @@
}, },
"metadata": {}, "metadata": {},
"output_type": "display_data" "output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"1\n"
]
} }
], ],
"source": [ "source": [
@@ -468,7 +476,13 @@
"\n", "\n",
"print(\"a\" in a.columns)\n", "print(\"a\" in a.columns)\n",
"\n", "\n",
"display(a.tail(1))" "b = a.tail(1)\n",
"\n",
"display(b)\n",
"\n",
"print(len(a))\n",
"print(len(b))\n",
"print(b.size)\n"
] ]
} }
], ],