Fix inconsistencies after rebase
This commit is contained in:
parent
3d1efa58a5
commit
2ddb9b75f9
@ -1,5 +1,5 @@
|
||||
solar:
|
||||
image: solarproject/solar-celery:f2s
|
||||
image: solarproject/solar-celery
|
||||
# path inside of the container should be exactly the same as outside
|
||||
# because solar uses absolute path to find resoruce actions files
|
||||
volumes:
|
||||
@ -19,12 +19,6 @@ solar:
|
||||
- riak
|
||||
- redis
|
||||
|
||||
# docker run --name solar -d -v /root/solar/solar:/solar -v /root/solar/solard:/solard -v /root/solar/templates:/templates \
|
||||
# -v /root/solar/resources:/resources -v /root/solar/f2s:/f2s \
|
||||
# -v /var/lib/fuel:/var/lib/fuel -v /root/.config/fuel/fuel_client.yaml:/etc/fuel/client/config.yaml -v /etc/puppet/modules:/etc/puppet/modules \
|
||||
# -v /root/.ssh:/root/.ssh \
|
||||
# --link=riak:riak --link=redis:redis solarproject/solar-celery:f2s
|
||||
|
||||
riak:
|
||||
image: tutum/riak
|
||||
ports:
|
||||
|
@ -34,20 +34,6 @@ from solar.orchestration import limits
|
||||
from solar.orchestration import executor
|
||||
from solar.dblayer import ModelMeta
|
||||
|
||||
from solar.dblayer.model import ModelMeta
|
||||
from functools import wraps
|
||||
|
||||
def session(func):
|
||||
@wraps(func)
|
||||
def inner(*args, **kwargs):
|
||||
try:
|
||||
ModelMeta.session_start()
|
||||
rst = func(*args, **kwargs)
|
||||
finally:
|
||||
ModelMeta.session_end()
|
||||
return rst
|
||||
return inner
|
||||
|
||||
|
||||
__all__ = ['solar_resource', 'cmd', 'sleep',
|
||||
'error', 'fault_tolerance', 'schedule_start', 'schedule_next']
|
||||
@ -85,7 +71,6 @@ def end_solar_session(task_id, task, *args, **kwargs):
|
||||
|
||||
|
||||
@report_task(name='solar_resource')
|
||||
@session
|
||||
def solar_resource(ctxt, resource_name, action):
|
||||
res = resource.load(resource_name)
|
||||
return actions.resource_action(res, action)
|
||||
@ -160,7 +145,6 @@ def schedule(plan_uid, dg):
|
||||
|
||||
|
||||
@app.task(name='schedule_start')
|
||||
@session
|
||||
def schedule_start(plan_uid):
|
||||
"""On receive finished task should update storage with task result:
|
||||
|
||||
@ -172,7 +156,6 @@ def schedule_start(plan_uid):
|
||||
|
||||
|
||||
@app.task(name='soft_stop')
|
||||
@session
|
||||
def soft_stop(plan_uid):
|
||||
dg = graph.get_graph(plan_uid)
|
||||
for n in dg:
|
||||
@ -182,7 +165,6 @@ def soft_stop(plan_uid):
|
||||
|
||||
|
||||
@app.task(name='schedule_next')
|
||||
@session
|
||||
def schedule_next(task_id, status, errmsg=None):
|
||||
plan_uid, task_name = task_id.rsplit(':', 1)
|
||||
dg = graph.get_graph(plan_uid)
|
||||
|
@ -1,63 +0,0 @@
|
||||
import os
|
||||
import yaml
|
||||
from bunch import Bunch
|
||||
|
||||
CWD = os.getcwd()
|
||||
|
||||
C = Bunch()
|
||||
C.redis = Bunch(port='6379', host='10.0.0.2')
|
||||
C.solar_db = Bunch(mode='riak', port='8087', host='10.0.0.2', protocol='pbc')
|
||||
|
||||
|
||||
def _lookup_vals(setter, config, prefix=None):
|
||||
for key, val in config.iteritems():
|
||||
if prefix is None:
|
||||
sub = [key]
|
||||
else:
|
||||
sub = prefix + [key]
|
||||
if isinstance(val, Bunch):
|
||||
_lookup_vals(setter, val, sub)
|
||||
else:
|
||||
setter(config, sub)
|
||||
|
||||
|
||||
def from_configs():
|
||||
|
||||
paths = [
|
||||
os.getenv('SOLAR_CONFIG', os.path.join(CWD, '.config')),
|
||||
os.path.join(CWD, '.config.override')
|
||||
]
|
||||
data = {}
|
||||
|
||||
def _load_from_path(data, path):
|
||||
with open(path) as f:
|
||||
loaded = yaml.load(f)
|
||||
if loaded:
|
||||
data.update(loaded)
|
||||
|
||||
for path in paths:
|
||||
if not os.path.exists(path):
|
||||
continue
|
||||
with open(path) as f:
|
||||
loaded = yaml.load(f)
|
||||
if loaded:
|
||||
data.update(loaded)
|
||||
|
||||
def _setter(config, path):
|
||||
vals = data
|
||||
for key in path:
|
||||
vals = vals[key]
|
||||
config[path[-1]] = vals
|
||||
if data:
|
||||
_lookup_vals(_setter, C)
|
||||
|
||||
|
||||
def from_env():
|
||||
def _setter(config, path):
|
||||
env_key = '_'.join(path).upper()
|
||||
if env_key in os.environ:
|
||||
config[path[-1]] = os.environ[env_key]
|
||||
_lookup_vals(_setter, C)
|
||||
|
||||
from_configs()
|
||||
from_env()
|
@ -1,9 +0,0 @@
|
||||
from solar.dblayer.model import ModelMeta
|
||||
from solar.dblayer.riak_client import RiakClient
|
||||
from solar.config import C
|
||||
|
||||
client = RiakClient(
|
||||
protocol=C.riak.protcol, host=C.riak.host, pb_port=C.riak.port)
|
||||
# client = RiakClient(protocol='http', host='10.0.0.2', http_port=8098)
|
||||
|
||||
ModelMeta.setup(client)
|
Loading…
x
Reference in New Issue
Block a user