Fix flake8 import rules

This commit is contained in:
Dmitry Shulyak 2015-11-30 14:55:31 +02:00
parent 2ddb9b75f9
commit 3075df61de
5 changed files with 19 additions and 14 deletions

View File

@ -115,12 +115,14 @@ def filter(uid, start, end):
utils.write_graph(plan)
click.echo('Created {name}.png'.format(name=plan.graph['name']))
@orchestration.command(help='Used to mark task as executed')
@click.argument('uid', type=SOLARUID)
@click.option('--task', '-t', multiple=True)
def noop(uid, task):
graph.set_states(uid, task)
@orchestration.command(name='run-once')
@click.argument('uid', type=SOLARUID, default='last')
@click.option('-w', 'wait', default=0)

View File

@ -15,6 +15,7 @@
from copy import deepcopy
from hashlib import md5
import json
import os
from uuid import uuid4
@ -296,6 +297,7 @@ class Resource(object):
if rst:
self.update(json.loads(rst))
def load(name):
r = DBResource.get(name)

View File

@ -12,22 +12,19 @@
# License for the specific language governing permissions and limitations
# under the License.
from collections import Counter
import time
import uuid
from collections import Counter
import networkx as nx
from solar.dblayer.model import clear_cache
from solar.dblayer.model import ModelMeta
from solar.dblayer.solar_models import Task
from solar import errors
from solar import utils
from solar.orchestration.traversal import states
from solar.dblayer.solar_models import Task
from solar.dblayer.model import clear_cache
from solar.dblayer.model import ModelMeta
from solar import utils
def save_graph(graph):
@ -58,6 +55,7 @@ def update_graph(graph):
task.errmsg = graph.node[n]['errmsg'] or ''
task.save()
def set_states(uid, tasks):
plan = get_graph(uid)
for t in tasks:
@ -67,6 +65,7 @@ def set_states(uid, tasks):
plan.node[t]['task'].save_lazy()
ModelMeta.save_all_lazy()
def get_graph(uid):
dg = nx.MultiDiGraph()
dg.graph['uid'] = uid

View File

@ -12,9 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import time
from functools import partial
import subprocess
import time
from functools import partial
from celery.app import task
from celery.signals import task_postrun
@ -30,9 +31,6 @@ from solar.orchestration.runner import app
from solar.orchestration.traversal import traverse
from solar.system_log.tasks import commit_logitem
from solar.system_log.tasks import error_logitem
from solar.orchestration import limits
from solar.orchestration import executor
from solar.dblayer import ModelMeta
__all__ = ['solar_resource', 'cmd', 'sleep',

View File

@ -17,8 +17,8 @@ import io
import json
import logging
import os
import subprocess
import uuid
from subprocess import Popen, PIPE, STDOUT
from jinja2 import Environment
import yaml
@ -36,7 +36,11 @@ def to_pretty_json(data):
def communicate(command, data):
popen = Popen(command, stdout=PIPE, stdin=PIPE, stderr=STDOUT)
popen = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
return popen.communicate(input=data)[0]
# Configure jinja2 filters