Skip to content

Commit e7f31f4

Browse files
timeseries: Added logic for core pinning (#2087)
This PR adds an optional CPU core-pinning entrypoint for the time-series-analytics container, allowing the service to prefer specific core types (E-cores/P-cores/low-power cores) via the CORE_PINNING environment variable. Changes: - Switch the container entrypoint from python3 main.py to a new /app/run.sh wrapper that optionally applies taskset. - Add a core-type detection script (detect-cores.sh) used by the entrypoint when CORE_PINNING is set to a supported core class. - Update the Dockerfile to copy the new scripts into the image and document the CORE_PINNING behavior. Signed-off-by: Vellaisamy, Sathyendran <sathyendran.vellaisamy@intel.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d42567e commit e7f31f4

3 files changed

Lines changed: 539 additions & 1 deletion

File tree

microservices/time-series-analytics/Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ COPY ./src/classifier_startup.py ./src/opcua_alerts.py ./src/main.py /app/
7474

7575
COPY ./config/kapacitor*.conf /app/config/
7676

77+
#Copying for Core Pinning
78+
COPY ./docker/run.sh /app/
79+
COPY ./docker/detect-cores.sh /app/
80+
RUN chmod +x /app/run.sh /app/detect-cores.sh
81+
7782
# Optionally download copyleft sources if requested
7883
ARG COPYLEFT_SOURCES=false
7984
RUN if [ "$COPYLEFT_SOURCES" = "true" ]; then \
@@ -127,4 +132,13 @@ USER $TIMESERIES_USER_NAME
127132
# Simple healthcheck to verify container is running
128133
HEALTHCHECK --interval=5m CMD exit 0
129134

130-
ENTRYPOINT ["python", "main.py"]
135+
# Optional CPU core pinning behavior:
136+
# - Set CORE_PINNING to control which CPU cores the service should prefer.
137+
# - Supported values:
138+
# * "e-cores" : prefer efficiency cores
139+
# * "p-cores" : prefer performance cores
140+
# * "lp-cores" : prefer low-power cores (if available)
141+
# - If CORE_PINNING is unset or empty, no explicit core pinning policy is applied.
142+
# The run.sh script uses detect-cores.sh together with CORE_PINNING (if set)
143+
# to determine and apply the appropriate core affinity at container startup.
144+
ENTRYPOINT ["./run.sh"]

0 commit comments

Comments
 (0)