Skip to content

Commit 8636aa0

Browse files
Fix pypi purl publishing issues
Signed-off-by: Ayan Sinha Mahapatra <asmahapatra@aboutcode.org>
1 parent ebf0c79 commit 8636aa0

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

minecode_pipelines/pipelines/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,12 @@ def _mine_and_publish_packageurls(
193193
)
194194
checkout["file_to_commit"].add(purl_file)
195195
checkout["file_processed_count"] += 1
196+
if logger:
197+
logger(f"{checkout['repo'].working_dir}: {checkout['file_processed_count']} / {batch_size}")
196198

197199
if len(checkout["file_to_commit"]) > batch_size:
200+
if logger:
201+
logger(f"Trying to commit PackageURLs.")
198202
pipes.commit_and_push_checkout(
199203
local_checkout=checkout,
200204
commit_message=commit_msg_func(checkout["commit_count"] + 1),

minecode_pipelines/pipelines/mine_pypi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MinePypi(MineCodeBasePipeline):
3030
a FederatedCode repo.
3131
"""
3232

33-
package_batch_size = 1000
33+
package_batch_size = 100
3434

3535
@classmethod
3636
def steps(cls):
@@ -70,7 +70,7 @@ def mine_packageurls(self):
7070
)
7171

7272
def save_check_point(self):
73-
pypi.update_mined_packages_in_checkpoint(
73+
pypi.save_mined_packages_in_checkpoint(
7474
packages_mined=self.packages_mined,
7575
config_repo=self.config_repo,
7676
logger=self.log,

minecode_pipelines/pipes/pypi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def mine_and_publish_pypi_packageurls(packages_to_sync, packages_mined, logger=N
246246

247247
# fetch packageURLs for package
248248
name = package.get("name")
249-
if logger:
249+
if logger and LOG_PACKAGEURL_DETAILS:
250250
logger(f"getting packageURLs for package: {name}")
251251

252252
# get repo and path for package
@@ -268,7 +268,7 @@ def mine_and_publish_pypi_packageurls(packages_to_sync, packages_mined, logger=N
268268
yield base_purl, packageurls
269269

270270

271-
def update_mined_packages_in_checkpoint(packages_mined, config_repo, logger=None):
271+
def save_mined_packages_in_checkpoint(packages_mined, config_repo, logger=None):
272272
"""Update mined packages checkpoint after processing a batch of packages."""
273273
if logger:
274274
logger(f"Checkpointing processed packages to: {PYPI_PACKAGES_CHECKPOINT_PATH}")

0 commit comments

Comments
 (0)