Page MenuHomePhabricator

Deploy precaching daemon for ORES
Closed, ResolvedPublic

Description

Right now the service runs in a screen. :(

Event Timeline

Halfak raised the priority of this task from to Needs Triage.
Halfak updated the task description. (Show Details)
Halfak moved this task to Backlog on the Machine-Learning-Team (Active Tasks) board.
Halfak subscribed.

Here's the command I use to run the script from the ore-wikimedia-config directory on my local machine. (I have the most recent master of 'ores' installed).

ores precached stream.wikimedia.org https://ores.wmflabs.org --config ores.wmflabs.org.yaml --verbose

Running even the plain binary ores command does not work:

root@ores-worker-01:/srv/ores# ./venv/bin/ores 
Traceback (most recent call last):
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 639, in _build_master
    ws.require(__requires__)
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 940, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 832, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.7.0 (/srv/ores/venv/lib/python3.4/site-packages), Requirement.parse('requests==2.5.3'), {'revscoring'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./venv/bin/ores", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3057, in <module>
    working_set = WorkingSet._build_master()
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 641, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 654, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 832, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.7.0 (/srv/ores/venv/lib/python3.4/site-packages), Requirement.parse('requests==2.5.3'), {'revscoring'})
root@ores-worker-01:/srv/ores# ls

See https://github.com/wiki-ai/revscoring/pull/150

@yuvipanda, once this PR is merged, then you shouldn't have this version issue.

Halfak set Security to None.

@yuvipanda, version issues cleaned up. This should work. :)

nope...

yuvipanda@ores-web-01:~$ /srv/ores/venv/bin/ores 
Traceback (most recent call last):
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 639, in _build_master
    ws.require(__requires__)
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 940, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 832, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.7.0 (/srv/ores/venv/lib/python3.4/site-packages), Requirement.parse('requests==2.5.3'), {'revscoring'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/ores/venv/bin/ores", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3057, in <module>
    working_set = WorkingSet._build_master()
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 641, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 654, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/srv/ores/venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 832, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.7.0 (/srv/ores/venv/lib/python3.4/site-packages), Requirement.parse('requests==2.5.3'), {'revscoring'})

Demonstration:

halfak@ores-staging-01:~$ /srv/ores/venv/bin/ores 
Usage:
    ores (-h | --help)
    ores <utility> [-h | --help]

precached daemon running in a screen on ores-compute. Feel free to kill when you are ready.

Halfak updated the task description. (Show Details)
Halfak added a subscriber: Ladsgroup.
Halfak added a subscriber: schana.

@schana interested in this task? It seems like setting this up in puppet makes sense. Here's the command we run to start the sync server:
ores precached stream.wikimedia.org https://ores.wmflabs.org --config ores-wikimedia-config/config/00-main.yaml

Is anyone working on this? If not, I'll take it up.

Note to self from a chat with yuvi:

http://github.com/wikimedia/operations-puppet is the puppet repo
but you can add roles from it using the 'manage instance' link in wikitech
https://wikitech.wikimedia.org/wiki/Help:Instances should hopefully have useful info

You'll just need to create a puppet role that deploys the ores codebase (similar to the others in the ores module) and sets up the precached daemon running via a systemd unit file.

I can't really seem to find examples right now but there's base::service_unit in the repo which should have examples about setting up the systemd stuff.

Not sure if you've already gone through the 'self hosted puppet' dance, if not that's what makes developing puppet roles on that repo easier. http://wikitech.wikimedia.org/wiki/Help:Self-hosted_puppetmaster has info.

I think this might be helpful for you :)
https://github.com/wikimedia/operations-puppet/tree/production/modules/ores

These are modules, I think they run it using manifests in the manifests folder but I'm probably wrong

I have coded the part to install systemd service. I have craeted a new class using wikitech "manage puppets group". It is called role::labs::ores::precached.

Now the thing is, I can apply the above role on a server which already has ores installed and this will work fine, precahed will start. I'm not sure if that is way it should be. According to me if I apply role::labs::ores::precached using configure instance link this should complete the setup.

My question is, how should I make sure that ores is installed and then this role is applied?

Here is the commit for the change:

https://gerrit.wikimedia.org/r/#/c/278555/1

Steps to launch a precached instance:

  1. Launch an instance inside ores or ores-staging context
  2. Apply the role role::labs::ores::precached using configure instance
  3. run fab initialize_server on the instance

@Halfak Please review when you get a chance. Should I be assigning this card to you (the reviewer)? Not sure what workflow we follow here.

@yuvipanda - do we monitor daemons with tools like monit or supervisord? would like to know your thoughts on how to resurrect precached in case it crashes, or at least we are not blind about its crash.

P.S. Also, sorry for the confusion about the extra traffic to ORES since I launched a preached instance. I should have informed you folks.

Sabya removed Sabya as the assignee of this task.Apr 9 2016, 10:06 AM

@schana interested in this task? It seems like setting this up in puppet makes sense. Here's the command we run to start the sync server:
ores precached stream.wikimedia.org https://ores.wmflabs.org --config ores-wikimedia-config/config/00-main.yaml

@Halfak - has this changed after https://github.com/wiki-ai/ores-wikimedia-config/commit/3e23e6e4ffe1a03e1e2819053e0a4ec599d82c01#commitcomment-17035708

I explained to @Sabya that ores needs to run from source directory (/srv/ores/config/ for fab deploys and /srv/ores/deploy for scap deploys) it's in the puppet, you don't need to install ores.

Here's what I posted on github:


I just talked this over with @Ladsgroup. We can do this without installing.

python submodules/ores/utility -h works, so we can do "python submodules/ores/utility precached ..." and expect it to work. How much trouble is it to run the precached service from this location?