Skip to content

Lal/coal enable runner data prod 15736#67

Open
lalepee wants to merge 6 commits intomainfrom
LAL/coal-enable-runner-data-PROD-15736
Open

Lal/coal enable runner data prod 15736#67
lalepee wants to merge 6 commits intomainfrom
LAL/coal-enable-runner-data-PROD-15736

Conversation

@lalepee
Copy link
Collaborator

@lalepee lalepee commented Mar 13, 2026

Add runner differentiation on output S3 and Azure storage and rework on delete to match the modification

@lalepee lalepee requested a review from neomatamune March 13, 2026 16:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds runner-level isolation for stored outputs by prepending runner_id to S3/Azure output prefixes, and introduces a new store delete command to delete runner-scoped output data.

Changes:

  • Add cosmotech.runner_id as a required key for S3 and Azure output channels and incorporate it into output prefixes.
  • Implement Azure blob deletion and wire channel delete operations (plus CLI store delete command).
  • Update unit tests and PostgreSQL runner metadata handling to use lastRunInfo.lastRunId.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
cosmotech/coal/store/output/az_storage_channel.py Prepends runner_id into Azure file_prefix and implements channel delete via Azure blob deletion.
cosmotech/coal/store/output/aws_channel.py Prepends runner_id into S3 prefix and simplifies sqlite upload path.
cosmotech/coal/azure/blob.py Adds delete_azure_blobs() implementation.
cosmotech/coal/aws/s3.py Adds a file_prefix setter to allow channels to update the effective prefix.
cosmotech/coal/postgresql/runner.py Switches runner metadata access to lastRunInfo.lastRunId for delete + return value.
cosmotech/csm_data/commands/store/store.py Registers the new store delete command.
cosmotech/csm_data/commands/store/delete.py New CLI command that triggers output deletion across configured targets.
tests/unit/coal/test_store/test_output/test_az_storage_channel.py Updates Azure output tests for runner-prefixed paths and delete behavior.
tests/unit/coal/test_store/test_output/test_aws_channel.py Updates AWS output tests for runner-prefixed paths and new upload signature usage.
tests/unit/coal/test_postgresql/test_postgresql_runner.py Updates runner metadata fixture shape to include lastRunInfo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +76 to +80
expected_config = base_azure_storage_config
expected_config.azure.file_prefix = (
base_azure_storage_config.cosmotech.runner_id + "/" + base_azure_storage_config.azure.file_prefix
)
mock_dump.assert_called_once_with(expected_config, selected_tables=None)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the channel init function create a new configuration object non prepend is happenning

Comment on lines +95 to 102
expected_config = base_azure_storage_config
expected_config.azure.file_prefix = (
base_azure_storage_config.cosmotech.runner_id + "/" + base_azure_storage_config.azure.file_prefix
)
mock_dump.assert_called_once_with(
base_azure_storage_config,
expected_config,
selected_tables=["table1", "table2"],
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, channel init function create a new configuration object no prepend is happening

Comment on lines 108 to +119
"""Test delete method (should do nothing)."""
channel = AzureStorageChannel(base_azure_storage_config)

# Act
result = channel.delete()
channel.delete()

# Assert
# Should not raise any exception and return None
assert result is None
expected_config = base_azure_storage_config
expected_config.azure.file_prefix = (
base_azure_storage_config.cosmotech.runner_id + "/" + base_azure_storage_config.azure.file_prefix
)
mock_delete.assert_called_once_with(expected_config)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re non

Comment on lines 105 to +112
schema_table = f"{_psql.db_schema}.{_psql.table_prefix}RunnerMetadata"
sql_delete_from_metatable = f"""
DELETE FROM {schema_table}
WHERE last_csm_run_id={runner.get("lastRunId")};
WHERE last_csm_run_id={runner.get("lastRunInfo").get("lastRunId")};
"""
curs.execute(sql_delete_from_metatable)
conn.commit()
return runner.get("lastRunId")
return runner.get("lastRunInfo").get("lastRunId")
Comment on lines +19 to +23
help=T("csm_data.commands.store.output.parameters.filter"),
type=str,
)
@web_help("csm-data/store/output")
@translate_help("csm_data.commands.store.output.description")
Comment on lines +106 to +114
def delete_azure_blobs(configuration: Configuration = Configuration()) -> None:
container_client = BlobServiceClient(
account_url=f"https://{configuration.azure.account_name}.blob.core.windows.net/",
credential=ClientSecretCredential(
tenant_id=configuration.azure.tenant_id,
client_id=configuration.azure.client_id,
client_secret=configuration.azure.client_secret,
),
).get_container_client(configuration.azure.container_name)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change absolutely nothing, parameter value is set/create a function call

Comment on lines +28 to +30
self.configuration.azure.file_prefix = (
self.configuration.cosmotech.runner_id + "/" + self.configuration.azure.file_prefix
)
@@ -37,11 +38,7 @@ def send(self, filter: Optional[list[str]] = None) -> bool:
if self._s3.output_type == "sqlite":
_file_path = _s._database_path
_file_name = "db.sqlite"
Comment on lines +15 to +33
@click.option(
"--filter",
"-f",
multiple=True,
help=T("csm_data.commands.store.output.parameters.filter"),
type=str,
)
@web_help("csm-data/store/output")
@translate_help("csm_data.commands.store.output.description")
def delete(
filter,
):
# Import the function at the start of the command
from cosmotech.coal.store.output import channel_spliter
from cosmotech.coal.utils.configuration import Configuration

try:
_cs = channel_spliter.ChannelSpliter(Configuration())
_cs.delete(list(filter))
Comment on lines +117 to +119
# List and delete blobs
blob_list = [b.name for b in container_client.list_blobs(name_starts_with=file_prefix)]
container_client.delete_blobs(*blob_list)
Copy link
Member

@neomatamune neomatamune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust you

@web_help("csm-data/store/delete")
@translate_help("csm_data.commands.store.delete.description")
def delete(
filter,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove the filter parameter

@lalepee lalepee requested a review from neomatamune March 18, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants