[英]When building conda packages using conda-build and my code uses pure python libraries, what do I need to put in build/host/run in the meta.yaml file?
[英]how to build a yaml file to run my python code
大家好,很抱歉這個愚蠢的問題,但這是我與 Yaml 的第二天。
steps:
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: '/bin/bash'
args: ['-c','virtualenv /workspace/venv' ]
# Create a Python virtualenv stored in /workspace/venv that will persist across container runs.
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: 'venv/bin/pip'
args: ['install', '-V', '-r', 'requirements.txt']
# Installs any dependencies listed in the project's requirements.txt.
問題:如何在 main.py 文件中添加調用/執行“my_function”的步驟?
感謝你的幫助。
steps:
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: '/bin/bash'
args: ['-c','virtualenv /workspace/venv' ]
# Create a Python virtualenv stored in /workspace/venv that will persist across container runs.
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: 'venv/bin/pip'
args: ['install', '-V', '-r', 'requirements.txt']
# Installs any dependencies listed in the project's requirements.txt.
假設我有一個文件main.py
:
def foo():
return "bar"
這實際上可以簡化為:
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: '/bin/bash'
args:
- '-c'
- |
virtualenv /workspace/venv
source /workspace/venv/bin/activate
pip install -V -r requirements.txt
python -c 'from main import foo; print (foo())'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.