Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
beem
Commits
344e461e
Commit
344e461e
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Readme changelog for next version
parent
9150e953
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.rst
+6
-0
6 additions, 0 deletions
README.rst
beem/blockchain.py
+5
-3
5 additions, 3 deletions
beem/blockchain.py
tests/beem/test_blockchain_threading.py
+8
-6
8 additions, 6 deletions
tests/beem/test_blockchain_threading.py
with
19 additions
and
9 deletions
README.rst
+
6
−
0
View file @
344e461e
...
...
@@ -156,6 +156,12 @@ before transmitting the packed file. Please check the hash-sum after downloading
Changelog
=========
0.19.39
-------
* get_feed_entries, get_blog_authors, get_savings_withdrawals, get_escrow, verify_account_authority, get_expiring_vesting_delegations added to Account
* get_account_reputations, get_account_count added to Blockchain
* ImageUploader class added
0.19.38
-------
* Bug fixes
...
...
This diff is collapsed.
Click to expand it.
beem/blockchain.py
+
5
−
3
View file @
344e461e
...
...
@@ -19,6 +19,7 @@ from datetime import datetime, timedelta
from
.utils
import
formatTimeString
,
addTzInfo
from
.block
import
Block
from
.exceptions
import
BatchedCallsNotSupported
,
BlockDoesNotExistsException
,
BlockWaitTimeExceeded
,
OfflineHasNoRPCException
from
beemapi.exceptions
import
NumRetriesReached
from
beemgraphenebase.py23
import
py23_bytes
from
beem.instance
import
shared_steem_instance
from
.amount
import
Amount
...
...
@@ -67,6 +68,7 @@ class Worker(Thread):
try
:
# the function may raise
result
=
func
(
*
args
,
**
kwargs
)
# print(result)
if
(
result
is
not
None
):
self
.
results
.
put
(
result
)
except
Exception
as
e
:
...
...
@@ -364,6 +366,9 @@ class Blockchain(object):
if
not
start
:
start
=
current_block_num
head_block_reached
=
False
if
threading
:
# pool = ThreadPoolExecutor(max_workers=thread_num + 1)
pool
=
Pool
(
thread_num
,
batch_mode
=
True
)
# We are going to loop indefinitely
while
True
:
...
...
@@ -374,8 +379,6 @@ class Blockchain(object):
current_block_num
=
self
.
get_current_block_num
()
head_block
=
current_block_num
if
threading
and
not
head_block_reached
:
# pool = ThreadPoolExecutor(max_workers=thread_num + 1)
pool
=
Pool
(
thread_num
,
batch_mode
=
True
)
# disable autoclean
auto_clean
=
current_block
.
get_cache_auto_clean
()
latest_block
=
start
-
1
...
...
@@ -392,7 +395,6 @@ class Blockchain(object):
i
+=
1
pool
.
run
(
True
)
pool
.
join
()
results
=
[]
for
result
in
pool
.
results
():
results
.
append
(
result
)
pool
.
abort
()
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_blockchain_threading.py
+
8
−
6
View file @
344e461e
...
...
@@ -46,17 +46,19 @@ class Testcases(unittest.TestCase):
ops_stream
=
[]
ops_stream_no_threading
=
[]
opNames
=
[
"
transfer
"
,
"
vote
"
]
block_num_list
=
[]
for
op
in
b
.
stream
(
opNames
=
opNames
,
start
=
self
.
start
,
stop
=
self
.
stop
,
threading
=
True
,
thread_num
=
2
):
ops_stream
.
append
(
op
)
if
op
[
"
block_num
"
]
not
in
block_num_list
:
block_num_list
.
append
(
op
[
"
block_num
"
])
block_num_list2
=
[]
for
op
in
b
.
stream
(
opNames
=
opNames
,
start
=
self
.
start
,
stop
=
self
.
stop
,
threading
=
False
):
ops_stream_no_threading
.
append
(
op
)
if
op
[
"
block_num
"
]
not
in
block_num_list2
:
block_num_list2
.
append
(
op
[
"
block_num
"
])
block_num_list
=
[]
for
op
in
b
.
stream
(
opNames
=
opNames
,
start
=
self
.
start
,
stop
=
self
.
stop
,
threading
=
True
,
thread_num
=
8
):
ops_stream
.
append
(
op
)
if
op
[
"
block_num
"
]
not
in
block_num_list
:
block_num_list
.
append
(
op
[
"
block_num
"
])
self
.
assertEqual
(
ops_stream
[
0
][
"
block_num
"
],
ops_stream_no_threading
[
0
][
"
block_num
"
])
self
.
assertEqual
(
ops_stream
[
-
1
][
"
block_num
"
],
ops_stream_no_threading
[
-
1
][
"
block_num
"
])
self
.
assertEqual
(
len
(
ops_stream_no_threading
),
len
(
ops_stream
))
...
...
@@ -69,7 +71,7 @@ class Testcases(unittest.TestCase):
blocks
=
[]
last_id
=
self
.
start
-
1
for
block
in
b
.
blocks
(
start
=
self
.
start
,
stop
=
self
.
stop
,
threading
=
True
,
thread_num
=
2
):
for
block
in
b
.
blocks
(
start
=
self
.
start
,
stop
=
self
.
stop
,
threading
=
True
,
thread_num
=
8
):
blocks
.
append
(
block
)
self
.
assertEqual
(
block
.
identifier
,
last_id
+
1
)
last_id
+=
1
...
...
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