Martin Blanchard pushed to branch mablanch/linting at BuildGrid / buildgrid
Commits:
-
395127bc
by Martin Blanchard at 2018-08-14T10:48:18Z
17 changed files:
- app/cli.py
- app/commands/cmd_bot.py
- app/commands/cmd_execute.py
- app/commands/cmd_server.py
- buildgrid/bot/bot.py
- buildgrid/bot/bot_interface.py
- buildgrid/server/build_grid_server.py
- buildgrid/server/cas/bytestream_service.py
- buildgrid/server/cas/content_addressable_storage_service.py
- buildgrid/server/execution/action_cache_service.py
- buildgrid/server/execution/execution_instance.py
- buildgrid/server/execution/execution_service.py
- buildgrid/server/execution/operations_service.py
- buildgrid/server/job.py
- buildgrid/server/scheduler.py
- buildgrid/server/worker/bots_service.py
- buildgrid/settings.py
Changes:
... | ... | @@ -24,10 +24,10 @@ will be attempted to be imported. |
24 | 24 |
"""
|
25 | 25 |
|
26 | 26 |
import os
|
27 |
-import sys
|
|
28 |
-import click
|
|
29 | 27 |
import logging
|
30 | 28 |
|
29 |
+import click
|
|
30 |
+ |
|
31 | 31 |
from . import _logging
|
32 | 32 |
|
33 | 33 |
CONTEXT_SETTINGS = dict(auto_envvar_prefix='BUILDGRID')
|
... | ... | @@ -23,25 +23,24 @@ Create a bot interface and request work |
23 | 23 |
"""
|
24 | 24 |
|
25 | 25 |
import asyncio
|
26 |
-import click
|
|
27 |
-import grpc
|
|
28 | 26 |
import logging
|
29 | 27 |
import os
|
30 | 28 |
import random
|
31 | 29 |
import subprocess
|
32 | 30 |
import tempfile
|
33 |
- |
|
34 | 31 |
from pathlib import Path, PurePath
|
35 | 32 |
|
33 |
+import click
|
|
34 |
+import grpc
|
|
35 |
+from google.protobuf import any_pb2
|
|
36 |
+ |
|
36 | 37 |
from buildgrid.bot import bot, bot_interface
|
37 | 38 |
from buildgrid.bot.bot_session import BotSession, Device, Worker
|
38 | 39 |
from buildgrid._exceptions import BotError
|
39 |
- |
|
40 |
-from ..cli import pass_context
|
|
41 |
- |
|
42 | 40 |
from buildgrid._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc
|
43 | 41 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
|
44 |
-from google.protobuf import any_pb2
|
|
42 |
+ |
|
43 |
+from ..cli import pass_context
|
|
45 | 44 |
|
46 | 45 |
|
47 | 46 |
@click.group(short_help='Create a bot client')
|
... | ... | @@ -22,18 +22,19 @@ Execute command |
22 | 22 |
Request work to be executed and monitor status of jobs.
|
23 | 23 |
"""
|
24 | 24 |
|
25 |
-import click
|
|
26 |
-import grpc
|
|
27 | 25 |
import logging
|
28 | 26 |
import sys
|
29 | 27 |
import time
|
30 | 28 |
|
31 |
-from ..cli import pass_context
|
|
29 |
+import click
|
|
30 |
+import grpc
|
|
31 |
+from google.protobuf import any_pb2
|
|
32 | 32 |
|
33 | 33 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
|
34 | 34 |
from buildgrid._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import ExecuteOperationMetadata
|
35 | 35 |
from buildgrid._protos.google.longrunning import operations_pb2, operations_pb2_grpc
|
36 |
-from google.protobuf import any_pb2
|
|
36 |
+ |
|
37 |
+from ..cli import pass_context
|
|
37 | 38 |
|
38 | 39 |
|
39 | 40 |
@click.group(short_help="Simple execute client")
|
... | ... | @@ -23,9 +23,10 @@ Create a BuildGrid server. |
23 | 23 |
"""
|
24 | 24 |
|
25 | 25 |
import asyncio
|
26 |
-import click
|
|
27 | 26 |
import logging
|
28 | 27 |
|
28 |
+import click
|
|
29 |
+ |
|
29 | 30 |
from buildgrid.server import build_grid_server
|
30 | 31 |
from buildgrid.server.action_cache import ActionCache
|
31 | 32 |
from buildgrid.server.cas.storage.disk import DiskStorage
|
... | ... | @@ -23,13 +23,10 @@ Creates a bot session. |
23 | 23 |
"""
|
24 | 24 |
|
25 | 25 |
import asyncio
|
26 |
-import collections
|
|
27 | 26 |
import logging
|
28 |
-import time
|
|
29 | 27 |
|
30 | 28 |
from . import bot_interface, bot_session
|
31 | 29 |
from .bot_session import BotStatus, LeaseState
|
32 |
-from .._exceptions import BotError
|
|
33 | 30 |
|
34 | 31 |
|
35 | 32 |
class Bot:
|
... | ... | @@ -26,8 +26,6 @@ import logging |
26 | 26 |
|
27 | 27 |
from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2, bots_pb2_grpc
|
28 | 28 |
|
29 |
-from .._exceptions import BotError
|
|
30 |
- |
|
31 | 29 |
|
32 | 30 |
class BotInterface:
|
33 | 31 |
"""
|
... | ... | @@ -22,10 +22,10 @@ BuildGridServer |
22 | 22 |
Creates the user a local server BuildGrid server.
|
23 | 23 |
"""
|
24 | 24 |
|
25 |
-import time
|
|
26 |
-import grpc
|
|
27 | 25 |
from concurrent import futures
|
28 | 26 |
|
27 |
+import grpc
|
|
28 |
+ |
|
29 | 29 |
from buildgrid._protos.google.bytestream import bytestream_pb2_grpc
|
30 | 30 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc
|
31 | 31 |
from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2_grpc
|
... | ... | @@ -24,9 +24,9 @@ CAS blobs. |
24 | 24 |
"""
|
25 | 25 |
|
26 | 26 |
import grpc
|
27 |
+ |
|
27 | 28 |
from buildgrid._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc
|
28 | 29 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2 as re_pb2
|
29 |
-from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc as re_pb2_grpc
|
|
30 | 30 |
|
31 | 31 |
from ...settings import HASH
|
32 | 32 |
|
... | ... | @@ -23,8 +23,6 @@ Implements the Content Addressable Storage API, which provides methods |
23 | 23 |
to check for missing CAS blobs and update them in bulk.
|
24 | 24 |
"""
|
25 | 25 |
|
26 |
-import grpc
|
|
27 |
- |
|
28 | 26 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2 as re_pb2
|
29 | 27 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc as re_pb2_grpc
|
30 | 28 |
|
... | ... | @@ -23,6 +23,7 @@ Allows clients to manually query/update the action cache. |
23 | 23 |
"""
|
24 | 24 |
|
25 | 25 |
import logging
|
26 |
+ |
|
26 | 27 |
import grpc
|
27 | 28 |
|
28 | 29 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
|
... | ... | @@ -21,14 +21,13 @@ ExecutionInstance |
21 | 21 |
An instance of the Remote Execution Server.
|
22 | 22 |
"""
|
23 | 23 |
|
24 |
-import uuid
|
|
25 | 24 |
import logging
|
26 | 25 |
|
27 | 26 |
from buildgrid._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import Action
|
28 | 27 |
|
29 | 28 |
from ._exceptions import InvalidArgumentError
|
30 | 29 |
|
31 |
-from ..job import Job, ExecuteStage
|
|
30 |
+from ..job import Job
|
|
32 | 31 |
|
33 | 32 |
|
34 | 33 |
class ExecutionInstance():
|
... | ... | @@ -22,14 +22,13 @@ ExecutionService |
22 | 22 |
Serves remote execution requests.
|
23 | 23 |
"""
|
24 | 24 |
|
25 |
-import grpc
|
|
26 | 25 |
import logging
|
27 | 26 |
import queue
|
28 | 27 |
from functools import partial
|
29 | 28 |
|
30 |
-from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
|
|
29 |
+import grpc
|
|
30 |
+ |
|
31 | 31 |
from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc
|
32 |
-from buildgrid._protos.google.longrunning import operations_pb2_grpc, operations_pb2
|
|
33 | 32 |
|
34 | 33 |
from ._exceptions import InvalidArgumentError
|
35 | 34 |
|
... | ... | @@ -21,9 +21,10 @@ OperationsService |
21 | 21 |
|
22 | 22 |
"""
|
23 | 23 |
|
24 |
-import grpc
|
|
25 | 24 |
import logging
|
26 | 25 |
|
26 |
+import grpc
|
|
27 |
+ |
|
27 | 28 |
from buildgrid._protos.google.longrunning import operations_pb2_grpc, operations_pb2
|
28 | 29 |
|
29 | 30 |
from ._exceptions import InvalidArgumentError
|
... | ... | @@ -17,14 +17,14 @@ |
17 | 17 |
|
18 | 18 |
import logging
|
19 | 19 |
import uuid
|
20 |
- |
|
21 | 20 |
from enum import Enum
|
22 | 21 |
|
22 |
+from google.protobuf import any_pb2
|
|
23 |
+ |
|
23 | 24 |
from buildgrid._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import ExecuteOperationMetadata
|
24 | 25 |
from buildgrid._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import ExecuteResponse
|
25 |
-from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2, worker_pb2
|
|
26 |
+from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2
|
|
26 | 27 |
from buildgrid._protos.google.longrunning import operations_pb2
|
27 |
-from google.protobuf import any_pb2
|
|
28 | 28 |
|
29 | 29 |
|
30 | 30 |
class ExecuteStage(Enum):
|
... | ... | @@ -23,9 +23,10 @@ Schedules jobs. |
23 | 23 |
|
24 | 24 |
from collections import deque
|
25 | 25 |
|
26 |
+from google.protobuf import any_pb2
|
|
27 |
+ |
|
26 | 28 |
from buildgrid._protos.build.bazel.remote.execution.v2.remote_execution_pb2 import ActionResult
|
27 | 29 |
from buildgrid._protos.google.longrunning import operations_pb2
|
28 |
-from google.protobuf import any_pb2
|
|
29 | 30 |
|
30 | 31 |
from .job import ExecuteStage, LeaseState
|
31 | 32 |
|
... | ... | @@ -21,13 +21,13 @@ BotsService |
21 | 21 |
|
22 | 22 |
"""
|
23 | 23 |
|
24 |
-import grpc
|
|
25 | 24 |
import logging
|
26 | 25 |
|
27 |
-from .bots_interface import BotsInterface
|
|
28 |
-from ._exceptions import InvalidArgumentError, OutofSyncError
|
|
26 |
+import grpc
|
|
29 | 27 |
|
30 |
-from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2, bots_pb2_grpc
|
|
28 |
+from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2_grpc
|
|
29 |
+ |
|
30 |
+from ._exceptions import InvalidArgumentError, OutofSyncError
|
|
31 | 31 |
|
32 | 32 |
|
33 | 33 |
class BotsService(bots_pb2_grpc.BotsServicer):
|
1 | 1 |
import hashlib
|
2 | 2 |
|
3 |
+ |
|
3 | 4 |
# The hash function that CAS uses
|
4 | 5 |
HASH = hashlib.sha256
|