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

✨Director-v2 passes the wallet ID to clusters-keeper #4930

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
OnDemandCluster,
)
from models_library.users import UserID
from models_library.wallets import WalletID
from servicelib.rabbitmq import (
RabbitMQRPCClient,
RemoteMethodNotRegisteredError,
Expand All @@ -24,15 +25,18 @@


async def get_or_create_on_demand_cluster(
user_id: UserID, rabbitmq_rpc_client: RabbitMQRPCClient
rabbitmq_rpc_client: RabbitMQRPCClient,
*,
user_id: UserID,
wallet_id: WalletID | None,
) -> BaseCluster:
try:
returned_cluster: OnDemandCluster = await rabbitmq_rpc_client.request(
RPCNamespace("clusters-keeper"),
RPCMethodName("get_or_create_cluster"),
timeout_s=300,
user_id=user_id,
wallet_id=None, # NOTE: --> MD this will need to be replaced by the real walletID
wallet_id=wallet_id,
)
_logger.info("received cluster: %s", returned_cluster)
if returned_cluster.state is not ClusterState.RUNNING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ async def _cluster_dask_client(
cluster: BaseCluster = scheduler.settings.default_cluster
if pipeline_params.use_on_demand_clusters:
cluster = await get_or_create_on_demand_cluster(
user_id, scheduler.rabbitmq_rpc_client
scheduler.rabbitmq_rpc_client,
user_id=user_id,
wallet_id=pipeline_params.run_metadata.get("wallet_id"),
)
if pipeline_params.cluster_id != DEFAULT_CLUSTER_ID:
clusters_repo = ClustersRepository.instance(scheduler.db_engine)
Expand Down