Skip to content

Commit

Permalink
Merge branch 'main' into crossmatch
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiomansillab authored Oct 22, 2024
2 parents 647b8f8 + f319e72 commit f6e1c3f
Show file tree
Hide file tree
Showing 39 changed files with 4,135 additions and 450 deletions.
4 changes: 2 additions & 2 deletions charts/lightcurve/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
appVersion: 24.9.1-rc123
appVersion: 24.10.1-rc127
description: Lightcurve API for ALeRCE Clients
name: lightcurve
type: application
version: 24.9.156
version: 24.10.160
38 changes: 38 additions & 0 deletions lightcurve/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
FROM python:3.11 as python-base
LABEL org.opencontainers.image.authors="ALeRCE"
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1


FROM python-base as builder
RUN pip install poetry
WORKDIR /app
COPY ./lightcurve/poetry.lock ./lightcurve/pyproject.toml /app
COPY ./libs/ralidator-core /libs/ralidator-core
COPY ./libs/ralidator-fastapi /libs/ralidator-fastapi
RUN poetry install --no-root --without=test

FROM node:22-alpine as tailwindcss_lightcurve
COPY ./lightcurve/ /lightcurve/
WORKDIR /lightcurve
RUN \
wget -nc https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.14/tailwindcss-linux-x64 -O tailwindcss && \
chmod +x tailwindcss && \
./tailwindcss -i /lightcurve/src/lightcurve_api/templates/main.css -o /compiled/main.css

FROM node:22-alpine as tailwindcss_object
COPY ./lightcurve/ /lightcurve/
WORKDIR /lightcurve
Expand All @@ -14,6 +42,15 @@ RUN \
chmod +x tailwindcss && \
./tailwindcss -i /lightcurve/src/magstats_api/templates/magstats.css -o /compiled/magstats.css

FROM node:22-alpine as tailwindcss_probability
COPY ./lightcurve/ /lightcurve/
WORKDIR /lightcurve
RUN \
wget -nc https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.13/tailwindcss-linux-x64 -O tailwindcss && \
chmod +x tailwindcss && \
./tailwindcss -i /lightcurve/src/probability_api/templates/probability.css -o /compiled/probability.css


FROM node:22-alpine as tailwindcss_crossmatch
COPY ./lightcurve/ /lightcurve/
WORKDIR /lightcurve
Expand All @@ -34,6 +71,7 @@ COPY ./lightcurve/src /app/src
COPY --from=tailwindcss_lightcurve /compiled/main.css /app/src/api/static
COPY --from=tailwindcss_magstats /compiled/magstats.css /app/src/magstats_api/static
COPY --from=tailwindcss_object /compiled/object.css /app/src/object_api/static
COPY --from=tailwindcss_probability /compiled/probability.css /app/src/probability_api/static
COPY --from=tailwindcss_crossmatch /compiled/crossmatch.css /app/src/crossmatch_api/static
RUN poetry install --only-root
CMD ["bash", "scripts/entrypoint.sh"]
22 changes: 17 additions & 5 deletions lightcurve/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ services:
environment:
SERVICE: lightcurve_api
API_URL: http://localhost:8001

object:
build:
context: ../
dockerfile: lightcurve/Dockerfile
ports:
- 8002:8000
env_file:
- variables.env
environment:
SERVICE: object_api
API_URL: http://localhost:8002

magstats:
build:
Expand All @@ -40,18 +52,18 @@ services:
environment:
SERVICE: magstats_api
API_URL: http://localhost:8003
object:

probability:
build:
context: ../
dockerfile: lightcurve/Dockerfile
ports:
- 8002:8000
- 8004:8000
env_file:
- variables.env
environment:
SERVICE: object_api
API_URL: http://localhost:8002
SERVICE: probability_api
API_URL: http://localhost:8004

crossmatch:
build:
Expand Down
4 changes: 3 additions & 1 deletion lightcurve/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lightcurve"
version = "24.9.1-rc123"
version = "24.10.1-rc127"
description = "Get lightcurve of objects from ZTF and ATLAS surveys"
authors = ["Diego Rodriguez Mancini"]
readme = "README.md"
Expand All @@ -10,6 +10,7 @@ packages = [
{ include = "lightcurve_api", from = "src" },
{ include = "magstats_api", from = "src" },
{ include = "object_api", from = "src" },
{ include = "probability_api", from = "src" },
{ include = "database", from = "src" },
]

Expand Down Expand Up @@ -71,4 +72,5 @@ dev = "scripts.run_dev:run"
lightcurve = "scripts.run_dev:run_lightcurve"
magstats = "scripts.run_dev:run_magstats"
object = "scripts.run_dev:run_object"
probability = "scripts.run_dev:run_probability"
tunnel = "scripts.sshproxy:run_tunnel"
7 changes: 7 additions & 0 deletions lightcurve/scripts/run_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ def run_object():
port = int(os.getenv("PORT", default=8000))
asyncio.run(run_service("object_api", port))


def run_crossmatch():
port = int(os.getenv("PORT", default=8000))
asyncio.run(run_service("crossmatch_api", port))


def run_probability():
port = int(os.getenv("PORT", default=8000))
asyncio.run(run_service("probability_api", port))


async def run_services(services, port):
tasks = []
for i, service in enumerate(services):
Expand Down
12 changes: 12 additions & 0 deletions lightcurve/scripts/run_probability_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os

import uvicorn


def run():
port = os.getenv("PORT", default=8000)
uvicorn.run("probability_api.api:app", port=int(port), reload=True, reload_dirs=[".", "../libs"])


if __name__ == "__main__":
run()
2 changes: 1 addition & 1 deletion lightcurve/src/lightcurve_api/static/lc-apparent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LightCurveOptions } from "./lc-utils.js";

export class ApparentLightCurveOptions extends LightCurveOptions {
constructor(detections, forcedPhotometry, fontColor, flux = false) {
super(detections, [], forcedPhotometry, fontColor, "Apparent Magnitude");
super(fontColor, "Apparent Magnitude");
this.detections = detections;
this.forcedPhotometry = forcedPhotometry;
this.getSeries(flux);
Expand Down
3 changes: 0 additions & 3 deletions lightcurve/src/lightcurve_api/static/lc-difference.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ export class DifferenceLightCurveOptions extends LightCurveOptions {
flux = false,
) {
super(
detections,
nonDetections,
forcedPhotometry,
fontColor,
"Difference Magnitude",
);
Expand Down
2 changes: 1 addition & 1 deletion lightcurve/src/lightcurve_api/static/lc-folded.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { jdToDate } from "./astro-dates.js";

export class FoldedLightCurveOptions extends LightCurveOptions {
constructor(detections, forcedPhotometry, fontColor, period, flux) {
super(detections, [], forcedPhotometry, fontColor, "Folded Light Curve");
super(fontColor, "Folded Light Curve");
this.detections = detections;
this.forcedPhotometry = forcedPhotometry;
this.period = period;
Expand Down
1 change: 1 addition & 0 deletions lightcurve/src/lightcurve_api/static/lc-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class LightCurveOptions {
4: { name: "c", color: "#00FFFF" },
5: { name: "o", color: "#FFA500" },
};

this.fontColor = fontColor;
this.options = {
grid: {
Expand Down
Loading

0 comments on commit f6e1c3f

Please sign in to comment.