Skip to content

Commit

Permalink
Merge pull request #159 from bedroge/reduce_github_calls
Browse files Browse the repository at this point in the history
Reduce the number of calls to the GitHub API
  • Loading branch information
boegel authored Sep 8, 2023
2 parents c0c88f1 + efd9a5b commit 8b2b7c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions scripts/automated_ingestion/automated_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def main():
logging.basicConfig(filename=log_file, format=log_format, level=log_level)
# TODO: check configuration: secrets, paths, permissions on dirs, etc
gh_pat = config['secrets']['github_pat']
gh = github.Github(gh_pat)
gh_staging_repo = github.Github(gh_pat).get_repo(config['github']['staging_repo'])
s3 = boto3.client(
's3',
aws_access_key_id=config['secrets']['aws_access_key_id'],
Expand All @@ -107,7 +107,7 @@ def main():
print(f'[{bucket}] {num}: {tarball}')
else:
for tarball in tarballs:
tar = EessiTarball(tarball, config, gh, s3, bucket)
tar = EessiTarball(tarball, config, gh_staging_repo, s3, bucket)
tar.run_handler()


Expand Down
5 changes: 2 additions & 3 deletions scripts/automated_ingestion/eessitarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class EessiTarball:
for which it interfaces with the S3 bucket, GitHub, and CVMFS.
"""

def __init__(self, object_name, config, github, s3, bucket):
def __init__(self, object_name, config, git_staging_repo, s3, bucket):
"""Initialize the tarball object."""
self.config = config
self.github = github
self.git_repo = github.get_repo(config['github']['staging_repo'])
self.git_repo = git_staging_repo
self.metadata_file = object_name + config['paths']['metadata_file_extension']
self.object = object_name
self.s3 = s3
Expand Down

0 comments on commit 8b2b7c6

Please sign in to comment.