-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update worker hash ring #58
Changes from 20 commits
e528626
bfcd30e
d23a344
9cb8b31
c926fab
8b7bb40
1848063
e264021
bfa42ab
274ff78
dfc787d
a5fe24c
9dd830c
fadc23a
5b82edd
b1b8d8e
119f4c2
b5bd9e4
421461a
af1d8b4
79bec76
60f7531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
import requests | ||
from requests.adapters import HTTPAdapter | ||
|
||
from .const import ALLUXIO_HASH_NODE_PER_WORKER_DEFAULT_VALUE | ||
from .const import ALLUXIO_HASH_NODE_PER_WORKER_KEY | ||
from .const import ALLUXIO_PAGE_SIZE_DEFAULT_VALUE | ||
from .const import ALLUXIO_PAGE_SIZE_KEY | ||
from .const import ALLUXIO_SUCCESS_IDENTIFIER | ||
|
@@ -141,20 +143,32 @@ def __init__( | |
"Supply either 'etcd_hosts' or 'worker_hosts', not both" | ||
) | ||
self.logger = logger or logging.getLogger("AlluxioFileSystem") | ||
if etcd_hosts and not worker_hosts: | ||
self.logger.warning( | ||
"Does not supply 'etcd_host'. Cannot tolerate Alluxio cluster changes." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
self.session = self._create_session(concurrency) | ||
|
||
# parse options | ||
page_size = ALLUXIO_PAGE_SIZE_DEFAULT_VALUE | ||
hash_node_per_worker = int(ALLUXIO_HASH_NODE_PER_WORKER_DEFAULT_VALUE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why we put default value as string and convert here? We can just define as int at the beginning. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ChunxuTang previously put Alluxio related key=value string pair into the const file, we can discuss about what are the best way for dealing with property key and values |
||
if options: | ||
if ALLUXIO_PAGE_SIZE_KEY in options: | ||
page_size = options[ALLUXIO_PAGE_SIZE_KEY] | ||
self.logger.debug(f"Page size is set to {page_size}") | ||
if ALLUXIO_HASH_NODE_PER_WORKER_KEY in options: | ||
hash_node_per_worker = int( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not int? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The const is all string format, the const file is kind of Alluxio property key files now |
||
options[ALLUXIO_HASH_NODE_PER_WORKER_KEY] | ||
) | ||
self.logger.debug( | ||
f"Hash node per worker is set to {hash_node_per_worker}" | ||
) | ||
|
||
self.page_size = humanfriendly.parse_size(page_size, binary=True) | ||
self.hash_provider = ConsistentHashProvider( | ||
etcd_hosts=etcd_hosts, | ||
etcd_port=int(etcd_port), | ||
worker_hosts=worker_hosts, | ||
worker_http_port=http_port, | ||
hash_node_per_worker=hash_node_per_worker, | ||
options=options, | ||
logger=self.logger, | ||
etcd_refresh_workers_interval=etcd_refresh_workers_interval, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use Union type in python to indicate OR semantic