Skip to content

Commit

Permalink
[improve][fn] add docs for supporting reading config options from fil…
Browse files Browse the repository at this point in the history
…es in Python runner (#544)
  • Loading branch information
Anonymitaet authored May 4, 2023
1 parent 373cefa commit 0577919
Show file tree
Hide file tree
Showing 2 changed files with 11,700 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/functions-runtime-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,37 @@ functionRuntimeFactoryConfigs:
```
For more details, see [code](https://github.com/apache/pulsar/blob/master/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeFactoryConfig.java).
### Set runtime parameter with configuration file
Pulsar Functions now supports setting runtime parameters using a configuration file **in Python**.
**Example**
You can start a Python runtime using the configuration file `config.ini` with the following command.

```shell
pulsar-admin functions localrun \
--py /path/to/python_instance.py \
--config-file /path/to/config.ini \
--classname MyFunction \
--logging_level debug \
--inputs persistent://public/default/my-input-topic \
--output persistent://public/default/my-output-topic \
--log-topic persistent://public/default/functions-logs
```

` --config-file` is the path to the configuration file. Note that:

- The ` --config-file` should be written in `.ini` format, with each parameter being configured as `key = value`.

**Example**

```ini
[DEFAULT]
logging_level = info
max_pending_async_requests = 1000
max_concurrent_requests = 50
```

- When you set a parameter through both the configuration file and the command line, like `logging_level` in the example above, the value set through the command line will **take precedence over** the one set through the configuration file. As a result, the value of `logging_level` is `debug`.
Loading

0 comments on commit 0577919

Please sign in to comment.