faust icon indicating copy to clipboard operation
faust copied to clipboard

Passing custom command line argument to faust app

Open misty256 opened this issue 3 years ago • 1 comments

Checklist

  • [x] I have included information about relevant versions
  • [x] I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

I need to pass a custom command line argumen to faust app. Example: python src/app.py worker my-argument This however lead to an Error: no such option: my-argument Looks like it is possible to pass only arguments known to faust, and there is no option to pass custom ones.

Expected behavior

Have a possibility for passing custom arguments to the app.

Actual behavior

Error: no such option: my-argument

Versions

  • Python version 3.9
  • Faust version 0.8.4
  • Operating system Mac OS
  • Kafka version 2.7.x

misty256 avatar May 11 '22 06:05 misty256

It depends on your use-case, but I've personally had success using argparse and passing the arguments to sys.argv. You can take a look at https://stackoverflow.com/questions/72182252/how-to-specify-faust-arguments-when-using-app-main/72231794#72231794 to know more.

To build this into faust, changes would have to be made in faust.cli.worker.worker which isn't exactly intended to be modified.

wbarnha avatar May 14 '22 00:05 wbarnha