jina-ai / jcloud

Simplify deploying and managing Jina projects on Jina Cloud
https://docs.jina.ai/concepts/jcloud/
Apache License 2.0
298 stars 13 forks source link

Flow deployment does not work as expected (flow id: cfca133db6) #72

Closed nan-wang closed 2 years ago

nan-wang commented 2 years ago

Flow deployment does work as expected

The flow is deployed successfully in jcloud. However, the problem is the variable I got from the executor is $1234 , instead of 1234

Command

.
├── executor
│   ├── config.yml
│   └── executor.py
├── flow.env
├── flow.py
└── flow.yml

Flow yaml

jtype: Flow
version: '1'
with:
  cors: true
  protocol: http
executors:
  - name: fooexecutor
    uses: executor/config.yml

Flow ID / Request ID

Flow ID: cfca133db6
Request ID: N/A

.env file

MY_TOKEN=123456789

jina version

jina -vf
...

executor.py

from jina import Executor, requests

class FooExecutor(Executor):
    def __init__(self, env_var, *args, **kwargs):
        super(FooExecutor, self).__init__(*args, **kwargs)
        self._token = env_var

    @requests
    def foo(self, docs, **kwargs):
        for doc in docs:
            doc.text = f'here is my token: {self._token}'

executor/config.yml

jtype: FooExecutor
with:
  env_var: ${{ ENV.MY_TOKEN }}
metas:
  py_modules:
    - executor.py

Additional context

Add any other context about the problem here.