Skip to content

Live data path#357

Open
Dagonite wants to merge 4 commits into
mainfrom
live-data-path
Open

Live data path#357
Dagonite wants to merge 4 commits into
mainfrom
live-data-path

Conversation

@Dagonite

@Dagonite Dagonite commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Rebase of #312.

Description

Adds a new env var and bases live data path on it.

Adds test cases.

@Pasarus Pasarus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a small rework needed on this see comments.

LiveDataRouter = APIRouter(prefix="/live")

CEPH_DIR = os.environ.get("CEPH_DIR", "/ceph")
GENERIC_DIR = "GENERIC" if os.environ.get("PRODUCTION", "").lower() == "true" else "GENERIC-staging"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably rename this, and rethink about the implementation so we can change the path from gitops.

Suggested change
GENERIC_DIR = "GENERIC" if os.environ.get("PRODUCTION", "").lower() == "true" else "GENERIC-staging"
LIVE_DATA_PATH = os.environ.get("LIVE_DATA_PATH", "GENERIC-staging") # Prod should be "GENERIC"


logger = logging.getLogger(__name__)

PRODUCTION = os.environ.get("PRODUCTION", "False").lower() == "true"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a rethink about if we need this as above.

"""
instrument_upper = instrument.upper()
live_data_path = Path(ceph_dir) / "GENERIC" / "livereduce" / instrument_upper
generic_dir = "GENERIC" if PRODUCTION else "GENERIC-staging"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we end up keeping this generic dir strategy that is determined from PRODUCTION env var, we should just define the path as the global variable instead of doing it here. We do that in the the live_data.py file (and other places) so let's maintain the same methodology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants