Skip to content
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

Support static membership #61

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions alluxio/alluxio_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
)
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)
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(
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,
Expand Down
4 changes: 4 additions & 0 deletions alluxio/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
ALLUXIO_ETCD_PASSWORD_KEY = "alluxio.etcd.password"
ALLUXIO_PAGE_SIZE_KEY = "alluxio.worker.page.store.page.size"
ALLUXIO_PAGE_SIZE_DEFAULT_VALUE = "1MB"
ALLUXIO_HASH_NODE_PER_WORKER_KEY = (
"alluxio.user.consistent.hash.virtual.node.count.per.worker"
)
ALLUXIO_HASH_NODE_PER_WORKER_DEFAULT_VALUE = "5"
ALLUXIO_SUCCESS_IDENTIFIER = "success"
LIST_URL_FORMAT = "http://{worker_host}:{http_port}/v1/files"
FULL_PAGE_URL_FORMAT = (
Expand Down
Loading
Loading