Skip to content

Commit

Permalink
feat: save pipeline executions to current dir if not prod
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Mar 28, 2024
1 parent 44a37f6 commit 4c8ab54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
9 changes: 7 additions & 2 deletions models/content-engine/__pipeline__.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@
"outputs": [],
"source": [
"engine_dir = os.path.join(entity_dir, engine_name, date.today().isoformat())\n",
"print(\"✅ Output directory:\", engine_dir)"
"print(\"✅ Output directory:\", engine_dir)\n",
"pipeline_dir = os.path.join(engine_dir, \"pipeline_executions\") if naas.is_production() else os.path.join(naas_data_product.MODELS_PATH, engine_name, \"custom\", \"pipeline_executions\")\n",
"print(\"✅ Pipeline directory:\", pipeline_dir)"
]
},
{
Expand Down Expand Up @@ -280,8 +282,11 @@
" name=\"Custom\",\n",
" notebook_path=os.path.join(naas_data_product.MODELS_PATH, engine_name, \"custom\", \"__pipeline__.ipynb\"),\n",
" parameters={\n",
" \"datalake_dir\": datalake_dir,\n",
" \"api_key\": api_key,\n",
" \"entity_name\": entity_name,\n",
" \"entity_dir\": entity_dir,\n",
" \"spreadsheet_url\": spreadsheet_url,\n",
" }\n",
" )\n",
"else:\n",
Expand Down Expand Up @@ -317,7 +322,7 @@
"\n",
"pipeline >> extraction >> cleaning >> analytics >> plugin >> email >> custom >> End()\n",
"\n",
"pipeline.run(outputs_path=os.path.join(engine_dir, \"pipeline_executions\"))"
"pipeline.run(outputs_path=pipeline_dir)"
]
},
{
Expand Down
9 changes: 7 additions & 2 deletions models/growth-engine/__pipeline__.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@
"outputs": [],
"source": [
"engine_dir = os.path.join(entity_dir, engine_name, date.today().isoformat())\n",
"print(\"✅ Output directory:\", engine_dir)"
"print(\"✅ Output directory:\", engine_dir)\n",
"pipeline_dir = os.path.join(engine_dir, \"pipeline_executions\") if naas.is_production() else os.path.join(naas_data_product.MODELS_PATH, engine_name, \"custom\", \"pipeline_executions\")\n",
"print(\"✅ Pipeline directory:\", pipeline_dir)"
]
},
{
Expand Down Expand Up @@ -340,8 +342,11 @@
" name=\"Custom\",\n",
" notebook_path=os.path.join(naas_data_product.MODELS_PATH, engine_name, \"custom\", \"__pipeline__.ipynb\"),\n",
" parameters={\n",
" \"datalake_dir\": datalake_dir,\n",
" \"api_key\": api_key,\n",
" \"entity_name\": entity_name,\n",
" \"entity_dir\": entity_dir,\n",
" \"spreadsheet_url\": spreadsheet_url,\n",
" }\n",
" )\n",
"else:\n",
Expand Down Expand Up @@ -377,7 +382,7 @@
"\n",
"pipeline >> linkedin >> interactions >> growth >> people >> organizations >> contacts >> analytics >> plugin >> email >> custom >> End()\n",
"\n",
"pipeline.run(outputs_path=os.path.join(engine_dir, \"pipeline_executions\"))"
"pipeline.run(outputs_path=pipeline_dir)"
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions models/sales-engine/__pipeline__.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@
"outputs": [],
"source": [
"engine_dir = os.path.join(entity_dir, engine_name, date.today().isoformat())\n",
"print(\"✅ Output directory:\", engine_dir)"
"print(\"✅ Output directory:\", engine_dir)\n",
"pipeline_dir = os.path.join(engine_dir, \"pipeline_executions\") if naas.is_production() else os.path.join(naas_data_product.MODELS_PATH, engine_name, \"custom\", \"pipeline_executions\")\n",
"print(\"✅ Pipeline directory:\", pipeline_dir)"
]
},
{
Expand Down Expand Up @@ -307,7 +309,7 @@
"\n",
"pipeline >> deals >> analytics >> plugin >> email >> custom >> End()\n",
"\n",
"pipeline.run(outputs_path=os.path.join(engine_dir, \"pipeline_executions\"))"
"pipeline.run(outputs_path=pipeline_dir)"
]
}
],
Expand Down

0 comments on commit 4c8ab54

Please sign in to comment.