qe-team / marmot

MARMOT - the open source framework for feature extraction and machine learning, designed to estimate the quality of Machine Translation output
ISC License
21 stars 7 forks source link

Global parameters #5

Closed varvara-l closed 9 years ago

varvara-l commented 9 years ago

There are some configuration parameters in the system that different functions and classes can require any time (for example, a special directory for temporary files, the number of processors the system can use). It's sometimes inconvenient to pass them to functions, so there should be a list of global variables which are seen from everywhere. But I don't know what is a good way to do it in python.

chrishokamp commented 9 years ago

for now we should use the conf.yaml file for this. That's already what we're doing with the workers: param in yaml.

I think we want to avoid globals because that's a code smell (especially in python). If a component needs a parameter from the config, like the tmp/ directory path, then it needs to be initialized with that parameter, probably with a sensible default in most cases.

So, for the alignment model, it should be initialized with a tmp/ dir location, and it should probably delete the alignment files by default once we're finished using them.

In the future, the user should be able to name the tmp/ dir after the experiment, so that different experiment configurations can be stored in different directories.

On Thu, Jan 15, 2015 at 3:26 PM, varvara-l notifications@github.com wrote:

There are some configuration parameters in the system that different functions and classes can require any time (for example, a special directory for temporary files, the number of processors the system can use). It's sometimes inconvenient to pass them to functions, so there should be a list of global variables which are seen from everywhere. But I don't know what is a good way to do it in python.

— Reply to this email directly or view it on GitHub https://github.com/qe-team/marmot/issues/5.

varvara-l commented 9 years ago

All global parameters should be defined in the config and passed to functions that need them. There won't be any global parameters seen from everywhere.