Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pothiers committed Sep 15, 2024
1 parent 4ba93d0 commit 43d4524
Showing 1 changed file with 30 additions and 41 deletions.
71 changes: 30 additions & 41 deletions notebooks_tsqr/NightLog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@
"metadata": {},
"outputs": [],
"source": [
"# Parameters. Set defaults here.\n",
"# Parameters. \n",
"# Times Square replaces this cell with the user's parameters.\n",
"\n",
"# The run-time defaults for all of these parameters are in NightLog.yaml\n",
"# Under Times Square, the run-time defaults always override values given here.\n",
"# Values here are used for local tests.\n",
"\n",
"# day_obs values: TODAY, YESTERDAY, YYYY-MM-DD\n",
"# Report on observing nights that start upto but not included this day.\n",
"day_obs = '2024-09-04' # Change to 'TODAY' to test with default before push \n",
"day_obs = '2024-09-04' # Value to use for local testing\n",
"#!day_obs = 'TODAY' # TODO Change to 'TODAY' to test with default before push \n",
"\n",
"# Total number of days of data to display (ending on day_obs)\n",
"number_of_days = '1' "
"number_of_days = '1' # TODO Change to '1' to test with default before push "
]
},
{
Expand Down Expand Up @@ -87,9 +92,9 @@
"usdf = 'https://usdf-rsp-dev.slac.stanford.edu'\n",
"tucson = 'https://tucson-teststand.lsst.codes'\n",
"\n",
"# Use server=tucson for dev testing.\n",
"# Use server=usdf to test before push.\n",
"server = os.environ.get('EXTERNAL_INSTANCE_URL', summit)"
"# The default provided here is for local testing.\n",
"# Under Times Square it is ignored.\n",
"server = os.environ.get('EXTERNAL_INSTANCE_URL', summit) # TODO try with \"usdf\" before push (else \"summit\")"
]
},
{
Expand All @@ -104,8 +109,7 @@
"if os.environ.get('EXTERNAL_INSTANCE_URL'):\n",
" !pip install git+https://github.com/lsst-ts/ts_logging_and_reporting.git@prototype >/dev/null\n",
"import lsst.ts.logging_and_reporting.source_adapters as sad\n",
"import lsst.ts.logging_and_reporting.almanac as alm\n",
"#from lsst.ts.logging_and_reporting.source_adapters import ExposurelogAdapter, NarrativelogAdapter"
"import lsst.ts.logging_and_reporting.almanac as alm"
]
},
{
Expand Down Expand Up @@ -181,16 +185,16 @@
"outputs": [],
"source": [
"nr_adapter = sad.NightReportAdapter(server_url=server)\n",
"url = nr_adapter.source_url\n",
"nr_url = nr_adapter.source_url\n",
"try:\n",
" nr_recs,url = nr_adapter.get_reports(\n",
" nr_recs,nr_url = nr_adapter.get_reports(\n",
" limit=limit,\n",
" min_day_obs=min_day_obs,\n",
" max_day_obs=max_day_obs,\n",
" )\n",
"except Exception as err:\n",
" nr_recs = []\n",
" msg = f'ERROR getting records from {url=}: {err=}'\n",
" msg = f'ERROR getting records from {nr_url=}: {err=}'\n",
" raise Exception(msg)"
]
},
Expand All @@ -201,7 +205,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(f'Retrieved {len(nr_recs)} records from {url}')"
"print(f'Retrieved {len(nr_recs)} records from {nr_url}')"
]
},
{
Expand All @@ -213,10 +217,15 @@
"source": [
"front = 'https://rubinobs.atlassian.net/projects/BLOCK?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/'\n",
"mdstr = '## Nightly Jira BLOCKs\\n'\n",
"for day, url_list in nr_adapter.nightly_tickets(nr_recs).items():\n",
" mdstr += f'- {day}\\n'\n",
" for ticket_url in url_list:\n",
" mdstr += f' - [{ticket_url.replace(front,\"\")}]({ticket_url})\\n'\n",
"tickets = nr_adapter.nightly_tickets(nr_recs)\n",
"if len(tickets) == 0:\n",
" mdstr += f'### No jira BLOCK tickets found.\\n'\n",
" mdstr += f'Used [API Data]({nr_url})\\n'\n",
"else:\n",
" for day, url_list in tickets.items():\n",
" mdstr += f'- {day}\\n'\n",
" for ticket_url in url_list:\n",
" mdstr += f' - [{ticket_url.replace(front,\"\")}]({ticket_url})\\n'\n",
"md(mdstr)"
]
},
Expand Down Expand Up @@ -265,16 +274,6 @@
"id": "17",
"metadata": {},
"outputs": [],
"source": [
"exposure_recs[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"metadata": {},
"outputs": [],
"source": [
"if exposure_recs:\n",
" tabstr = exposure_adapter.day_table(exposure_recs, 'date_added', time_only=False)\n",
Expand All @@ -285,7 +284,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "18",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -308,7 +307,7 @@
},
{
"cell_type": "markdown",
"id": "20",
"id": "19",
"metadata": {},
"source": [
"# Narrative Log\n"
Expand All @@ -317,7 +316,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "21",
"id": "20",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -345,17 +344,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"metadata": {},
"outputs": [],
"source": [
"narrative_recs[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"id": "21",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -368,7 +357,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "24",
"id": "22",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit 43d4524

Please sign in to comment.