Skip to content

Commit

Permalink
Run pyink formatter on the whole repo #cleanup
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595168542
  • Loading branch information
p3rf Team authored and copybara-github committed Jan 2, 2024
1 parent 5f8a20c commit c7d8205
Show file tree
Hide file tree
Showing 580 changed files with 31,107 additions and 17,078 deletions.
1 change: 1 addition & 0 deletions CHANGES.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,4 @@
- Moved flags from `pkb.py` to `flags.py` to help avoid circular dependencies.
- Updated tracer dstat to use pcp dstat.
- Removed Windows 2012 after loss of support on all clouds.
- Formatted entire directory with https://github.com/google/pyink.
1 change: 1 addition & 0 deletions perfkitbenchmarker/app_service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing class for BaseAppService and BaseAppServiceSpec."""

import logging
import threading
import time
Expand Down
30 changes: 17 additions & 13 deletions perfkitbenchmarker/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
from perfkitbenchmarker.providers.aws.util import AWS_PATH


def ArchiveRun(run_temp_directory, target_bucket,
prefix='',
gsutil_path='gsutil',
aws_path=AWS_PATH):
def ArchiveRun(
run_temp_directory,
target_bucket,
prefix='',
gsutil_path='gsutil',
aws_path=AWS_PATH,
):
"""Archive a run directory to GCS or S3.
Args:
Expand All @@ -45,24 +48,25 @@ def ArchiveRun(run_temp_directory, target_bucket,
raise ValueError('{0} is not a directory.'.format(run_temp_directory))

tar_file_name = '{}{}.tar.gz'.format(
prefix, datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
prefix, datetime.datetime.now().strftime('%Y%m%d%H%M%S')
)

prefix_len = 5
prefixes = {
's3://': [aws_path, 's3', 'cp'],
'gs://': [gsutil_path, 'cp']
}
prefixes = {'s3://': [aws_path, 's3', 'cp'], 'gs://': [gsutil_path, 'cp']}

assert all(len(key) == prefix_len for key in prefixes), prefixes

try:
cmd = (prefixes[target_bucket[:prefix_len]] +
['-', posixpath.join(target_bucket, tar_file_name)])
cmd = prefixes[target_bucket[:prefix_len]] + [
'-',
posixpath.join(target_bucket, tar_file_name),
]
except KeyError:
raise ValueError('Unsupported bucket name: {0}'.format(target_bucket))

logging.info('Streaming %s to %s\n%s', run_temp_directory, tar_file_name,
' '.join(cmd))
logging.info(
'Streaming %s to %s\n%s', run_temp_directory, tar_file_name, ' '.join(cmd)
)
p = subprocess.Popen(cmd, stdin=subprocess.PIPE)

with p.stdin:
Expand Down
Loading

0 comments on commit c7d8205

Please sign in to comment.