Skip to content

Commit

Permalink
add alternative worker commands, config options
Browse files Browse the repository at this point in the history
  • Loading branch information
skirui-source committed Nov 8, 2023
1 parent 441fb88 commit a356add
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dask_databricks/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def main():
"""Tools to launch Dask on Databricks."""

@main.command()
def run():
@click.option('--worker-command', help='Custom worker command')
@click.option('--worker-args', help='Additional worker arguments as a single string')
def run(worker_command, worker_args):
"""Run Dask processes on a Databricks cluster."""
log = get_logger()

Expand Down Expand Up @@ -48,7 +50,15 @@ def run():
except ConnectionRefusedError:
log.info("Scheduler not available yet. Waiting...")
time.sleep(1)
subprocess.Popen(["dask", "worker", f"tcp://{DB_DRIVER_IP}:8786"])

# Construct the worker command
worker_command = worker_command.split() if worker_command else ["dask", "worker"]
if worker_args:
worker_command.extend(worker_args.split())

worker_command.append(f"tcp://{DB_DRIVER_IP}:8786")

subprocess.Popen(worker_command)


if __name__ == "__main__":
Expand Down

0 comments on commit a356add

Please sign in to comment.