Skip to content

Commit

Permalink
Merge branch 'develop' into u/ch/ligo
Browse files Browse the repository at this point in the history
  • Loading branch information
hernandezc1 authored Apr 19, 2024
2 parents b240422 + f3cc25e commit 25642b1
Show file tree
Hide file tree
Showing 93 changed files with 1,973 additions and 821 deletions.
11 changes: 6 additions & 5 deletions .readthedocs.yml → .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
Expand All @@ -13,10 +19,5 @@ formats: []

# Set the version of Python and requirements required to build the docs
python:
version: 3.7
system_packages: true
install:
- requirements: docs/requirements.txt
- method: setuptools
path: .

11 changes: 3 additions & 8 deletions broker/broker_utils/broker_utils/avro_schemas/load.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""The ``avro_schemas.load`` module loads and returns Avro schemas.
"""
The ``avro_schemas.load`` module loads and returns Avro schemas.
REGISTERED_SCHEMAS = [
"elasticc.v0_9.alert.avsc",
"elasticc.v0_9.brokerClassification.avsc",
"elasticc.v0_9_1.alert.avsc",
"elasticc.v0_9_1.brokerClassification.avsc",
]
To view a list of registered schema names, use: ``avro_schemas.load.REGISTERED_SCHEMAS``
"""

from importlib.resources import path as rpath
Expand Down
10 changes: 6 additions & 4 deletions broker/broker_utils/broker_utils/gcp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,24 +355,26 @@ def query_bigquery(
Optional job config to send with the query.
Example query:
``
.. code-block:: python
query = (
f'SELECT * '
f'FROM `{dataset_project_id}.{dataset}.{table}` '
f'WHERE objectId={objectId} '
)
``
Examples of working with the query_job:
``
.. code-block:: python
# Cast it to a DataFrame:
query_job.to_dataframe()
# Iterate row-by-row
for r, row in enumerate(query_job):
# row values can be accessed by field name or index
print(f"objectId={row[0]}, candid={row['candid']}")
``
"""
if project_id is None:
project_id = project_id_default
Expand Down
1 change: 1 addition & 0 deletions broker/broker_utils/broker_utils/math.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""The ``math`` module contains mathematical transforms for survey data."""

from typing import Tuple

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions broker/broker_utils/broker_utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def __init__(self, alert_dir: Union[str, Path] = "ztf"):
Either the path to a directory containing alerts or one of the
following strings.
"ALERT_DIR" or "alert_dir": The path will be obtained from the
environment variable ALERT_DIR.
environment variable ALERT_DIR.
"ztf" or "elasticc": The path will be obtained from the environment
variable given by ``f"ALERT_DIR_{alert_dir.upper()}"``
variable given by ``f"ALERT_DIR_{alert_dir.upper()}"``
"""
if alert_dir in ["ALERT_DIR", "alert_dir"]:
self.alert_dir = Path(os.getenv("ALERT_DIR"))
Expand Down
4 changes: 2 additions & 2 deletions broker/setup_broker/setup_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ teardown="${2:-False}"
survey="${3:-ztf}"
# name of the survey this broker instance will ingest
# 'ztf' or 'decat'
schema_version="${4:-3.3}"
versiontag=v$(echo "${schema_version}" | tr . _) # 3.3 -> v3_3
schema_version="${4:-4.02}"
versiontag=v$(echo "${schema_version}" | tr . _) # 4.02 -> v4_02
use_authentication="${5:-false}" # whether the consumer VM should use an authenticated connection
region="${6:-us-central1}"
zone="${region}-a" # just use zone "a" instead of adding another script arg
Expand Down
2 changes: 2 additions & 0 deletions broker/setup_broker/setup_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def _resources(service, survey='ztf', testid='test', versiontag="v3_3"):

if service == 'GCS':
buckets = { # '<bucket-name>': ['<file-name to upload>',]
# the avro bucket f'{PROJECT_ID}-{survey}_alerts_{versiontag}'
# is managed in broker/cloud_functions/ps_to_gcs/deploy.sh
f'{PROJECT_ID}-{survey}-broker_files': [],
f'{PROJECT_ID}-{survey}-testing_bucket':
['ztf_3.3_validschema_1154446891615015011.avro'],
Expand Down
Loading

0 comments on commit 25642b1

Please sign in to comment.