Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
9159a668
Commit
9159a668
authored
7 years ago
by
Tim
Browse files
Options
Downloads
Patches
Plain Diff
serve.py lint
parent
90933bf3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/server/serve.py
+13
-14
13 additions, 14 deletions
hive/server/serve.py
lint
+6
-1
6 additions, 1 deletion
lint
with
19 additions
and
15 deletions
hive/server/serve.py
+
13
−
14
View file @
9159a668
...
...
@@ -3,17 +3,11 @@ import os
import
logging
from
datetime
import
datetime
import
sqlalchemy
as
sa
from
sqlalchemy.engine.url
import
make_url
from
aiohttp
import
web
from
aiopg.sa
import
create_engine
from
jsonrpcserver.aio
import
methods
from
jsonrpcserver
import
config
config
.
debug
=
True
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logger
=
logging
.
getLogger
(
__name__
)
from
hive.db.methods
import
(
db_head_state
,
get_followers
,
...
...
@@ -27,6 +21,11 @@ from hive.db.methods import (
payouts_last_24h
)
config
.
debug
=
True
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logger
=
logging
.
getLogger
(
__name__
)
jrpc_methods
=
(
db_head_state
,
get_followers
,
...
...
@@ -76,13 +75,13 @@ async def health(request):
state
[
'
db_head_age
'
],
app
[
'
config
'
][
'
hive.MAX_BLOCK_NUM_DIFF
'
]
*
3
,
state
[
'
db_head_block
'
])),
status
=
500
)
else
:
return
web
.
json_response
(
data
=
dict
(
status
=
'
OK
'
,
source_commit
=
os
.
environ
.
get
(
'
SOURCE_COMMIT
'
),
docker_tag
=
os
.
environ
.
get
(
'
DOCKER_TAG
'
),
state
=
state
,
timestamp
=
datetime
.
utcnow
().
isoformat
()))
return
web
.
json_response
(
data
=
dict
(
status
=
'
OK
'
,
source_commit
=
os
.
environ
.
get
(
'
SOURCE_COMMIT
'
),
docker_tag
=
os
.
environ
.
get
(
'
DOCKER_TAG
'
),
state
=
state
,
timestamp
=
datetime
.
utcnow
().
isoformat
()))
async
def
jsonrpc_handler
(
request
):
...
...
@@ -100,7 +99,7 @@ app.router.add_post('/', jsonrpc_handler)
if
__name__
==
'
__main__
'
:
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
"
hivemind jsonrpc server
"
)
parser
.
add_argument
(
'
--database_url
'
,
type
=
str
,
default
=
'
postgresql://root:root_password@127.0.0.1:5432/testdb
'
)
parser
.
add_argument
(
'
--database_url
'
,
type
=
str
,
default
=
'
postgresql://root:root_password@127.0.0.1:5432/testdb
'
)
parser
.
add_argument
(
'
--port
'
,
type
=
int
,
default
=
8080
)
args
=
parser
.
parse_args
()
app
[
'
config
'
][
'
args
'
]
=
args
...
...
This diff is collapsed.
Click to expand it.
lint
+
6
−
1
View file @
9159a668
pylint hive/**/*.py -f colorized -r n
if [ -z "$1" ]
then
pylint hive/**/*.py -f colorized -r n
else
pylint $1 -f colorized -r n
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment