Skip to content

Commit 4ff70e1

Browse files
committed
Fix pipeline failure when there is no new increment to mine
Resolves #786 Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent a105f8f commit 4ff70e1

4 files changed

Lines changed: 19 additions & 7 deletions

File tree

minecode_pipelines/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
#
99

1010

11-
VERSION = "0.1.0"
11+
VERSION = "0.1.1"

minecode_pipelines/pipelines/mine_maven.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def steps(cls):
4343
cls.fetch_federation_config,
4444
cls.fetch_checkpoint_and_maven_index,
4545
cls.mine_and_publish_maven_packageurls,
46+
cls.save_check_point,
4647
cls.delete_working_dir,
4748
)
4849

@@ -59,7 +60,10 @@ def fetch_checkpoint_and_maven_index(self):
5960

6061
last_incremental = checkpoint.get("last_incremental")
6162
self.log(f"last_incremental: {last_incremental}")
62-
self.maven_nexus_collector = maven.MavenNexusCollector(last_incremental=last_incremental)
63+
self.maven_nexus_collector = maven.MavenNexusCollector(
64+
last_incremental=last_incremental,
65+
logger=self.log,
66+
)
6367

6468
def mine_and_publish_maven_packageurls(self):
6569
_mine_and_publish_packageurls(
@@ -71,7 +75,6 @@ def mine_and_publish_maven_packageurls(self):
7175
append_purls=self.append_purls,
7276
commit_msg_func=self.commit_message,
7377
logger=self.log,
74-
checkpoint_func=self.save_check_point,
7578
)
7679

7780
def save_check_point(self):

minecode_pipelines/pipes/maven.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,13 @@ class MavenNexusCollector:
569569
WARNING: Processing is rather long: a full index is ~600MB.
570570
"""
571571

572-
def __init__(self, index_location=None, index_properties_location=None, last_incremental=None):
572+
def __init__(
573+
self,
574+
index_location=None,
575+
index_properties_location=None,
576+
last_incremental=None,
577+
logger=None,
578+
):
573579
if index_location and last_incremental:
574580
raise Exception(
575581
"index_location and last_incremental cannot both be set at the same time. "
@@ -599,6 +605,8 @@ def __init__(self, index_location=None, index_properties_location=None, last_inc
599605
self.index_increment_locations = [
600606
download.path for download in index_increment_downloads
601607
]
608+
if logger and not self.index_increment_locations:
609+
logger("No new index increment to mine.")
602610
elif index_location:
603611
self.index_location = index_location
604612
self.index_increment_locations = []
@@ -723,8 +731,9 @@ def _get_packages_from_index_increments(self):
723731

724732
def get_packages(self):
725733
"""Yield Package objects from maven index or index increments"""
734+
packages = []
726735
if self.index_increment_locations:
727736
packages = chain(self._get_packages_from_index_increments())
728-
else:
737+
elif self.index_location:
729738
packages = self._get_packages(content=self.index_location)
730739
return packages

pyproject-minecode_pipelines.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "flot.buildapi"
44

55
[project]
66
name = "minecode_pipelines"
7-
version = "0.1.0"
7+
version = "0.1.1"
88
description = "A library for mining packageURLs and package metadata from ecosystem repositories."
99
readme = "minecode_pipelines/README.rst"
1010
license = { text = "Apache-2.0" }
@@ -64,7 +64,7 @@ mine_swift = "minecode_pipelines.pipelines.mine_swift:MineSwift"
6464
mine_composer = "minecode_pipelines.pipelines.mine_composer:MineComposer"
6565

6666
[tool.bumpversion]
67-
current_version = "0.1.0"
67+
current_version = "0.1.1"
6868
allow_dirty = true
6969

7070
files = [

0 commit comments

Comments
 (0)