Skip to content
Open
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 @@ -124,11 +124,10 @@ def add_output_port(
if port_id.internal is None:
port_id.internal = False

if storage_uri_base is not None:
self.set_up_port_storage_writer(port_id, storage_uri_base)

# each port can only be added and initialized once.
if port_id not in self._ports:
if storage_uri_base is not None:
self.set_up_port_storage_writer(port_id, storage_uri_base)
self._ports[port_id] = WorkerPort(schema)

def set_up_port_storage_writer(self, port_id: PortIdentity, storage_uri_base: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@ def test_port_can_only_be_added_once(self, output_manager):
assert output_manager.get_port_ids() == [port_id]
assert output_manager.get_port().get_schema() is schema_first

def test_duplicate_port_does_not_start_replacement_storage_writers(
self, output_manager
):
output_manager.set_up_port_storage_writer = MagicMock()
port_id = PortIdentity(id=0, internal=False)
output_manager.add_output_port(port_id, MagicMock(), "vfs:///first")
output_manager.add_output_port(port_id, MagicMock(), "vfs:///duplicate")
output_manager.set_up_port_storage_writer.assert_called_once_with(
port_id, "vfs:///first"
)

def test_sets_up_storage_writer_only_when_uri_given(self, output_manager):
output_manager.set_up_port_storage_writer = MagicMock()
port_a = PortIdentity(id=0, internal=False)
Expand Down
Loading