Skip to content

Commit dbcef1c

Browse files
committed
fix: multi source runner
1 parent de52c31 commit dbcef1c

File tree

4 files changed

+17
-47
lines changed

4 files changed

+17
-47
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
from .base import RepoSource, SourceSettings, all_sources
22
from .csv_source import CSVInputSettings, CSVInputSource
33
from .github_source import GithubSettings, GithubSource
4+
from .single_source import SingleSettings, SingleSource
45

56
__all__ = [
67
"CSVInputSettings",
78
"CSVInputSource",
89
"GithubSettings",
910
"GithubSource",
1011
"RepoSource",
12+
"SingleSettings",
13+
"SingleSource",
1114
"SourceSettings",
1215
"all_sources",
1316
]

codegen-on-oss/codegen_on_oss/sources/github_source.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GithubSettings(SourceSettings, env_prefix="GITHUB_"):
2323
# "dependency",
2424
] = "stars"
2525
token: str | None = None
26+
num_repos: int = 50
2627

2728

2829
class GithubSource(RepoSource[GithubSettings]):
@@ -37,8 +38,8 @@ class GithubSource(RepoSource[GithubSettings]):
3738
source_type: ClassVar[str] = "github"
3839
settings_cls: ClassVar[type[GithubSettings]] = GithubSettings
3940

40-
def __init__(self) -> None:
41-
super().__init__()
41+
def __init__(self, *args, **kwargs) -> None:
42+
super().__init__(*args, **kwargs)
4243
if self.settings.token is None:
4344
self.github_client = Github()
4445
else:

codegen-on-oss/input.csv

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,2 @@
11
repo_url, commit_hash
22
https://github.com/JohnSnowLabs/spark-nlp.git,7d2bed7647bec3878362a4b7ebbe43befeabe2ba
3-
https://github.com/Lightning-AI/lightning.git,b313cd955bb7cc38bd899a023dfc43f4f194d50b
4-
https://github.com/PrefectHQ/prefect.git,3fa131368278cddd865802090b70c2ec5c971e8b
5-
https://github.com/apache/mxnet.git,b84609d3fc73d20929c114eab95faaa56e6c5ede
6-
https://github.com/celery/celery.git,7d5157343cc919b0f94d602ff1d2c037b38815a3
7-
https://github.com/conan-io/conan.git,8488bcbc051a0511f1bf1e92ff991dfcab4a5644
8-
https://github.com/conda/conda.git,b557176f293bb5b94ce6680524cd4e088ddffac2
9-
https://github.com/dagster-io/dagster.git,b3db2312329c0a809ed98b362da44c8ea9690a25
10-
https://github.com/docker/compose.git,d956ff13daacbb15905ac2877428e4e9cbcb65da
11-
https://github.com/explosion/spaCy.git,b3c46c315eb16ce644bddd106d31c3dd349f6bb2
12-
https://github.com/gitpython-developers/GitPython.git,e034cec8bbed5d21ca15f415a541c41c6cab0463
13-
https://github.com/google/jax.git,1079dc4477d41fd25397c8d0b78a32bdc5fa48da
14-
https://github.com/googleapis/google-cloud-python.git,04a1a30536c108b912ac45482496929fddd7beea
15-
https://github.com/huggingface/transformers.git,9f51dc25357bcde280a02b59e80b66248b018ca4
16-
https://github.com/ipython/ipython.git,aedea319404107bfec9f7c70356cbba68790c06e
17-
https://github.com/jupyterlab/jupyterlab.git,f15d555c89f3aa73bb16610d8056a1597bce6edc
18-
https://github.com/kubeflow/pipelines.git,8ca7ec1768f82f50b3b46606f39632eab11b8fe6
19-
https://github.com/mesonbuild/meson.git,1b54239a88261cbb679a342162d72632cd6b8093
20-
https://github.com/numpy/numpy.git,5566cc4375badc1a1f218c4a1bb8924abbf34618
21-
https://github.com/open-mmlab/mmdetection.git,cfd5d3a985b0249de009b67d04f37263e11cdf3d
22-
https://github.com/pandas-dev/pandas.git,d4dff29713faeb74931407ebd3e441253f883708
23-
https://github.com/pantsbuild/pants.git,6cc70e3245c968c006caf5697fd01cb5f8f54092
24-
https://github.com/pyca/cryptography.git,f95dda8bce1dac984ac3e0da188f66027184a69e
25-
https://github.com/pypa/pip.git,ce9451518f17cedf1efb3481526ae760bfdbe1a5
26-
https://github.com/python/typeshed.git,132456af62b1d15e966e490d9ba9235d2f6bbf2e
27-
https://github.com/ray-project/ray.git,094fde63cdce99bfe7ddca30d5a04c0759c86ffd
28-
https://github.com/scipy/scipy.git,0a934b1ffb1269a244cc007851632c466acdc5a0
29-
https://github.com/tensorflow/models.git,4a56eff0ad5ce23f64f7638167c3256b36da3b07
30-
https://github.com/tiangolo/fastapi.git,8c9c536c0a277125ca95c0d9ef19e2c6a39d1db8
31-
https://github.com/twisted/twisted.git,45dd522fcc218ebbc11afa1ed03c77768e7b8e44
32-
https://github.com/wagtail/wagtail.git,81171b1eaec3f30809f7ce27768bfb6c129e1d99
33-
https://github.com/ytdl-org/youtube-dl.git,711e72c292327674c4a0593fdbb83d6347738ec9
34-
https://github.com/DataDog/integrations-core.git,4329c4522f860bc90673d66313722c3b64b0a433
35-
https://github.com/vercel/next.js.git,20748811c66899fa8eaa221cab96a02a86bc0dd6

codegen-on-oss/modal_run.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import sys
33
from pathlib import Path
4-
from typing import Literal
54

65
import modal
76
from loguru import logger
@@ -115,16 +114,13 @@ def parse_repo_on_modal(
115114

116115
@parse_app.local_entrypoint()
117116
def main(
118-
source: Literal["csv", "single", "github"] = "csv",
117+
source: str = "csv",
119118
csv_file: str = "input.csv",
120119
single_url: str = "https://github.com/codegen-sh/codegen-sdk.git",
121120
single_commit: str | None = None,
122-
github_language: Literal["python", "typescript"] = "python",
123-
github_heuristic: Literal[
124-
"stars",
125-
"forks",
126-
"updated",
127-
] = "stars",
121+
github_language: str = "python",
122+
github_heuristic: str = "stars",
123+
github_num_repos: int = 50,
128124
):
129125
"""
130126
Main entrypoint for the parse app.
@@ -140,15 +136,18 @@ def main(
140136
"CSV_FILE_PATH": f"/app/inputs/{input_path}",
141137
}
142138
case "single":
143-
env = {
144-
"SINGLE_URL": single_url,
145-
"SINGLE_COMMIT": single_commit,
146-
}
139+
env = {"SINGLE_URL": single_url}
140+
if single_commit:
141+
env["SINGLE_COMMIT"] = single_commit
147142
case "github":
148143
env = {
149144
"GITHUB_LANGUAGE": github_language,
150145
"GITHUB_HEURISTIC": github_heuristic,
146+
"GITHUB_NUM_REPOS": str(github_num_repos),
151147
}
148+
case _:
149+
msg = f"Invalid source: {source}"
150+
raise ValueError(msg)
152151

153152
return parse_repo_on_modal.remote(
154153
source=source,

0 commit comments

Comments
 (0)