Skip to content

Commit

Permalink
Fix and test num_chunks and num_workers error
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Jan 26, 2022
1 parent dc05fbf commit 65ccef6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/maggma/cli/distributed.py
Expand Up @@ -33,7 +33,7 @@ async def manager(
"""
logger = getLogger("Manager")

if not num_chunks and num_workers:
if not (num_chunks and num_workers):
raise ValueError("Both num_chunks and num_workers must be non-zero")

logger.info(f"Binding to Manager URL {url}:{port}")
Expand Down
18 changes: 18 additions & 0 deletions tests/cli/test_distributed.py
Expand Up @@ -56,6 +56,24 @@ def process_items(self, items):
SERVER_PORT = 8234


@pytest.mark.xfail(raises=ValueError)
@pytest.mark.asyncio
async def test_wrong_worker_input(log_to_stdout):

manager_server = asyncio.create_task(
manager(
SERVER_URL,
SERVER_PORT,
[DummyBuilder(dummy_prechunk=False)],
num_chunks=2,
num_workers=0,
)
)

await asyncio.sleep(1)
manager_server.result()


@pytest.mark.asyncio
async def test_manager_give_out_chunks(log_to_stdout):

Expand Down

0 comments on commit 65ccef6

Please sign in to comment.