Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

How to define global options in "pyleus_topology.yaml" for all components? #163

Open
arnolddeng85 opened this issue Oct 30, 2015 · 2 comments

Comments

@arnolddeng85
Copy link

I want to define DB server info(host, port, etc.) which are used by all the spouts and bolts. But I think it is hard to maintain if I define the same DB server info at the options under all the components on "pyleus_topology.yaml". Such as:

    - spout:
        options:
               host: 192.168.0.1
               port: 3306
    - bolt:
        options:
               host: 192.168.0.1
               port: 3306
    - bolt:
        options:
               host: 192.168.0.1
               port: 3306

So how to define global options in "pyleus_topology.yaml" for all components and how to get the global options at component class code?

@poros
Copy link
Contributor

poros commented Oct 30, 2015

Yeah, I agree that this is not ideal. I don't believe it's possible to use "variables" in YAML and there is no easy workaround I can think about.

Implementing a Python DSL for specifying topologies instead than just a YAML config file would easily solve this problem, but I don't believe there is any plan to do that for now. If you really care about this, you could write a tiny Python script to generate your YAML file and run it via your Makefile (I did that a couple of times, it's not great, but it works).

@arnolddeng85
Copy link
Author

OK. Thanks for your suggestion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants