No puedo ejecutar la segunda instrucción arg:
<SPAN class="hljs-string">"python"</SPAN>, <SPAN class="hljs-string">"-c"</SPAN>, <SPAN class="hljs-string">"from main import foo;print(foo('hello'))"</SPAN>
Estoy activando una compilación en la nube con el operador Airflow pitón función. Tanto el DAG que lo activó como Cloud Build regresaron correctamente.
El primer argumento para instalar el archivo requirements.txt parece funcionar según el mensaje de registro devuelto por Cloud Build:
Requirement already satisfied: setuptools>=<SPAN class="hljs-number">40.3</SPAN><SPAN class="hljs-number">.0</SPAN> <SPAN class="hljs-keyword">in</SPAN> /usr/local/lib/python3<SPAN class="hljs-number">.7</SPAN>/site-packages (<SPAN class="hljs-keyword">from</SPAN> google-auth>=<SPAN class="hljs-number">1.2</SPAN>->gcsfs>=<SPAN class="hljs-number">0.6</SPAN><SPAN class="hljs-number">.2</SPAN>
Mi función es usar el paquete gcsfs. La función que he usado en la pregunta es solo para demostración.
Antes de usar Airflow, tenía esto funcionando en un archivo yaml. Probé varias formas diferentes de expresar el argumento, como:
<SPAN class="hljs-string">"args"</SPAN>:[<SPAN class="hljs-string">"-c"</SPAN>,<SPAN class="hljs-string">"pip install -V -r requirements.txt; python -c from main import foo;print(foo('hello'))"</SPAN>]Pero ahora dando vueltas en círculos.
Agradecería mucho cualquier ayuda para que funcione esa declaración de args.
Este es el CloudBuildCreateBuildOperator del DAG:
create_build_from_storage_body = {
<SPAN class="hljs-string">"source"</SPAN>: {
<SPAN class="hljs-string">"repoSource"</SPAN>: {
<SPAN class="hljs-string">"projectId"</SPAN>: <SPAN class="hljs-string">"dev-6767"</SPAN>,
<SPAN class="hljs-string">"repoName"</SPAN>: <SPAN class="hljs-string">"bq-pipeline"</SPAN>,
<SPAN class="hljs-string">"branchName"</SPAN>: <SPAN class="hljs-string">"master"</SPAN>,
}
},
<SPAN class="hljs-string">"steps"</SPAN>: [{
<SPAN class="hljs-string">"name"</SPAN>: <SPAN class="hljs-string">"docker.io/library/python:3.7"</SPAN>,
<SPAN class="hljs-string">"entrypoint"</SPAN>: <SPAN class="hljs-string">"/bin/bash"</SPAN>,
<SPAN class="hljs-string">"args"</SPAN>: [<SPAN class="hljs-string">"-c"</SPAN>, <SPAN class="hljs-string">"pip install -V -r requirements.txt"</SPAN>,
<SPAN class="hljs-string">"python"</SPAN>, <SPAN class="hljs-string">"-c"</SPAN>, <SPAN class="hljs-string">"from main import foo;print(foo('hello'))"</SPAN>
],
}],
}
Puede ser que alguien de aquí pueda ofrecer ayuda, pero sospecho que puede tener más éxito en un foro más relacionado con Flujo de aire .