Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit d05d8fe

Browse files
committed
feat: import packages from external artifact
Instead of relying on current data/ directory, import the packages from an external artifact that comes from codegate-data
1 parent 10818a9 commit d05d8fe

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/import_packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ jobs:
7070
export BACKUP_FOLDER=backup
7171
# Conditionally export the variables only if artifact download is enabled
7272
if [ "${{ github.event.inputs.enable_artifact_download }}" == "true" ]; then
73-
python scripts/import_packages.py
73+
python scripts/import_packages.py --jsonl-dir /tmp/jsonl-files/
7474
else
75-
python scripts/import_packages.py --restore-backup False
75+
python scripts/import_packages.py --restore-backup False --jsonl-dir /tmp/jsonl-files/
7676
fi
7777
7878
- name: 'Upload Backup Files'

scripts/import_packages.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class PackageImporter:
17-
def __init__(self, take_backup=True, restore_backup=True):
17+
def __init__(self, jsonl_dir='data', take_backup=True, restore_backup=True):
1818
self.take_backup_flag = take_backup
1919
self.restore_backup_flag = restore_backup
2020

@@ -29,9 +29,9 @@ def __init__(self, take_backup=True, restore_backup=True):
2929
)
3030
)
3131
self.json_files = [
32-
"data/archived.jsonl",
33-
"data/deprecated.jsonl",
34-
"data/malicious.jsonl",
32+
os.path.join(jsonl_dir, "archived.jsonl"),
33+
os.path.join(jsonl_dir, "deprecated.jsonl"),
34+
os.path.join(jsonl_dir, "malicious.jsonl"),
3535
]
3636
self.client.connect()
3737
self.inference_engine = LlamaCppInferenceEngine()
@@ -149,9 +149,15 @@ async def run_import(self):
149149
help="Specify whether to restore a backup before "
150150
"data import (True or False). Default is True.",
151151
)
152+
parser.add_argument(
153+
"--jsonl-dir",
154+
type=str,
155+
default="data",
156+
help="Directory containing JSONL files. Default is 'data'."
157+
)
152158
args = parser.parse_args()
153159

154-
importer = PackageImporter(take_backup=args.take_backup, restore_backup=args.restore_backup)
160+
importer = PackageImporter(jsonl_dir=args.jsonl_dir, take_backup=args.take_backup, restore_backup=args.restore_backup)
155161
asyncio.run(importer.run_import())
156162
try:
157163
assert importer.client.is_live()

0 commit comments

Comments
 (0)