Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Patch to add HTTP support for configuration file #3

Open
GoogleCodeExporter opened this issue May 10, 2015 · 4 comments
Open

Patch to add HTTP support for configuration file #3

GoogleCodeExporter opened this issue May 10, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

I added HTTP support to MOE for the --project_config and --db paths.
With this patch, you can now do stuff like:

  java -jar moe.jar check_config --config_file http://server/project_config

This patch makes it so a company can use a simple REST API internally for 
maintaining projects, and not have to worry about everything necessarily being 
on NFS. It is backward compatible with old usage: if a path is given (without a 
file:// or http:// scheme specifier), it will assume it is a file.

Here is the patch:     https://gist.github.com/1158363





Additionally, I wrote two quick Python scripts for testing and/or reference for 
this new feature.

I wrote a tiny example HTTP server:
* https://gist.github.com/1158377
  moe_config_server.py is a simple example server that implements the
REST api just mentioned. It takes a single argument, which is the port it will 
run on (defaults to 8080). It serves up "./projects/[project_name]/config.js" 
and "./projects/[project_name]/moe.db"

To make calling MOE repeatedly, I wrote a tiny wrapper Python script:
* https://gist.github.com/1158379
moe.py wraps around the main MOE adding arguments based on what it finds in a 
JSON file, "~/.moerc". This saves the user from having to type --test_config 
and --db with every call, and works with the above example server. With moe.py, 
you can just do commands like "moe.py project_name check_config"

Original issue reported on code.google.com by [email protected] on 23 Aug 2011 at 9:29

@GoogleCodeExporter
Copy link
Author

While I agree that having HTTP support is good, I would much prefer to keep it 
separate from FileDb. Perhaps an HttpDb?

Original comment by [email protected] on 24 Aug 2011 at 7:01

@GoogleCodeExporter
Copy link
Author

Sure. Though, only 2 lines were changed from FileDb, so since they both deal 
with flat, JSON DBs how does moving most of that class to a base class which 
FileDb and HttpDb extend sound? Maybe I'll just change Db from an interface 
into a base class with a "static Db make(String resource)" method so it can 
choose which one? (I don't know what other changes you are planning for the Db 
stuff.)

Original comment by [email protected] on 24 Aug 2011 at 8:54

@GoogleCodeExporter
Copy link
Author

I've been working on some changes to Db stuff, and may decide to make Db an 
abstract class instead of an interface. This is very tentative still, but my 
thoughts are that if this happens, then FileDb, HttpDb, and any other Db types 
will just have a unique method makeDb() and a unique method update() to write 
back to the Db (specific to where it's stored) plus helper methods. Helper 
methods common to many Db types such as the extant makeDbFromDbText() could go 
into the Db class, resulting in perhaps renaming makeDbFromDbText() to 
makeDbFromJsonText() once in the Db class.

Original comment by [email protected] on 24 Aug 2011 at 9:42

@GoogleCodeExporter
Copy link
Author

Sounds reasonable. Well, since it looks like things are still not in stone yet 
in the changes on your side, you probably are in the best position to merge 
this feature into the next commit.

Original comment by [email protected] on 25 Aug 2011 at 10:53

cgruber added a commit to cgruber/MOE that referenced this issue Feb 19, 2019
Bump version numbers on deps, and add in kotlin-mockito for later.
cgruber added a commit to cgruber/MOE that referenced this issue Aug 31, 2020
Rework git revision history so it does a single fetch for a whole history.
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

1 participant