Михаил Бараковский
03/21/2023, 8:40 AM>>> import subprocess
>>> subprocess.run('yc --help', shell=True, capture_output=True, text=True)
jpuris
03/21/2023, 8:44 AMМихаил Бараковский
03/21/2023, 8:48 AMFROM python:3.9
RUN apt-get update && apt-get install -y \
openssl \
libssl-dev
RUN update-ca-certificates
RUN apt-get install -y python3-opencv \
python3-dev \
default-mysql-client \
freetds-dev \
uuid \
curl
RUN curl <https://storage.yandexcloud.net/yandexcloud-yc/install.sh> | bash -s -- -a
ENV TINI_VERSION v0.19.0
ADD <https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini> /usr/local/bin/tini
RUN chmod +x /usr/local/bin/tini
COPY docker/prefect/requirements.txt /app/requirements.txt
RUN pip install 'prefect[git]==1.2.4' && \
python3.9 -m pip install -r /app/requirements.txt
#COPY config.toml /root/.prefect/config.toml
COPY docker/prefect/freetds.conf /etc/freetds/freetds.conf
COPY replicator /tmp/replicator
ENV PYTHONPATH /tmp
ENTRYPOINT ["tini", "--"]
jpuris
03/21/2023, 8:55 AMyc
bin
In your flow code, run
subprocess.run('/root/yandex-cloud/bin/yc --help', shell=True, capture_output=True, text=True)
instead of
subprocess.run('yc --help', shell=True, capture_output=True, text=True)
This happens because when you run this within the container by first initing the shell, the PATH containing yc
gets exported.
When this is run outside the shell (i.e. prefect agent process), yc
is not in the PATHМихаил Бараковский
03/21/2023, 11:17 AMjpuris
03/28/2023, 3:27 PMimport os
os.environ['PATH'] += ':/root/yandex-cloud/bin/'
subprocess.run('yc --help', shell=True, capture_output=True, text=True)
Михаил Бараковский
03/28/2023, 3:43 PM