Skip to content

Commit 8b2b7c6

Browse files
authored
Merge pull request #159 from bedroge/reduce_github_calls
Reduce the number of calls to the GitHub API
2 parents c0c88f1 + efd9a5b commit 8b2b7c6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

scripts/automated_ingestion/automated_ingestion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
logging.basicConfig(filename=log_file, format=log_format, level=log_level)
9393
# TODO: check configuration: secrets, paths, permissions on dirs, etc
9494
gh_pat = config['secrets']['github_pat']
95-
gh = github.Github(gh_pat)
95+
gh_staging_repo = github.Github(gh_pat).get_repo(config['github']['staging_repo'])
9696
s3 = boto3.client(
9797
's3',
9898
aws_access_key_id=config['secrets']['aws_access_key_id'],
@@ -107,7 +107,7 @@ def main():
107107
print(f'[{bucket}] {num}: {tarball}')
108108
else:
109109
for tarball in tarballs:
110-
tar = EessiTarball(tarball, config, gh, s3, bucket)
110+
tar = EessiTarball(tarball, config, gh_staging_repo, s3, bucket)
111111
tar.run_handler()
112112

113113

scripts/automated_ingestion/eessitarball.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ class EessiTarball:
1919
for which it interfaces with the S3 bucket, GitHub, and CVMFS.
2020
"""
2121

22-
def __init__(self, object_name, config, github, s3, bucket):
22+
def __init__(self, object_name, config, git_staging_repo, s3, bucket):
2323
"""Initialize the tarball object."""
2424
self.config = config
25-
self.github = github
26-
self.git_repo = github.get_repo(config['github']['staging_repo'])
25+
self.git_repo = git_staging_repo
2726
self.metadata_file = object_name + config['paths']['metadata_file_extension']
2827
self.object = object_name
2928
self.s3 = s3

0 commit comments

Comments
 (0)