Skip to content

Add logic to copy historical data - #2187

Open
vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:history
Open

Add logic to copy historical data#2187
vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:history

Conversation

@vish-cs

@vish-cs vish-cs commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to ingest historic data from GCS into the versioned output directory, controlled by a new configuration flag ingest_historic_data. However, the changes also comment out the virtual environment creation (_create_venv), replacing it with a dummy process and sys.executable, which will bypass dependency installation and likely cause runtime failures. Additionally, the GCS blob listing logic for historic data should be refined to use a slash-terminated prefix to prevent matching unintended directories and to simplify path parsing.

Comment thread import-automation/executor/app/executor/import_executor.py Outdated
Comment thread import-automation/executor/app/executor/import_executor.py
storage_client = storage.Client(self.config.gcs_project_id)
bucket = storage_client.bucket(
self.config.storage_prod_bucket_name)
source_prefix = f'{output_dir}/historic/'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wondering if it would be safer to list specific files in GCS to be used in the manifest.json rather than picking up all files. This would make reviews easier, o/w copy to historic folder will have to wait until the update is reviewed.

On the flip side, this will add some overhead of managing the list through manual PRs rather than automatic simple file copy.

if import_summary:
import_summary.import_stats['historic_data_size'] = historic_data_size
import_summary.data_volume += historic_data_size
logging.info(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we also log the number and names of files that were copied?

import_summary.import_stats.get('validation_data_size', 0))
logging.info(import_summary)

if self.config.ingest_historic_data:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be a list of files rather than a flag? If non-empty, then files are copied.

storage_client = storage.Client(self.config.gcs_project_id)
bucket = storage_client.bucket(
self.config.storage_prod_bucket_name)
source_prefix = f'{output_dir}/historic/'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

instead of hardcoding the folder '/historic/', can this be a parameter that defaults to /historic/?

if blob.size:
historic_data_size += blob.size
except Exception as e:
logging.error(f'Failed to copy historic data from GCS: {e}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pls log the src and dst file names as well.

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.

2 participants