Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.2.98 upstream3 #222

Merged
merged 25 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5503dbd
Bump urllib3 from 1.26.9 to 1.26.12 in /hail/python (#12140)
dependabot[bot] Aug 31, 2022
9710e97
[auth] Cache user sessions in memory (#12122)
daniel-goldstein Aug 31, 2022
9db647e
Revert "[auth] Cache user sessions in memory (#12122)" (#12148)
daniel-goldstein Aug 31, 2022
e9d4e52
[query] Table.write_many (#12091)
danking Aug 31, 2022
c0f95b9
[ci] authorized users cleanup (#12137)
danking Aug 31, 2022
015b687
Bump importlib-resources from 5.7.1 to 5.9.0 in /hail/python/dev (#12…
dependabot[bot] Aug 31, 2022
2351431
[batch] Do not retry pulling images from invalid repositories (#12152)
daniel-goldstein Sep 1, 2022
d272c89
[ci] Add retry to git push in test repo creation (#12153)
daniel-goldstein Sep 1, 2022
9ddf1d6
Adds my user information to AUTHORIZED_USERS (#12156)
iris-garden Sep 6, 2022
1c29b0c
Bump filelock from 3.7.1 to 3.8.0 in /hail/python (#12157)
dependabot[bot] Sep 7, 2022
2c622d9
[ggplot] make identity color scale continuous (#12089)
patrick-schultz Sep 7, 2022
dba732f
[batch] Filter for disks or disk on azure pricing api (#12169)
daniel-goldstein Sep 9, 2022
f30a802
[query] handle retry once errors in the correct order (#12166)
iris-garden Sep 9, 2022
a1f0532
Bump types-python-dateutil from 2.8.17 to 2.8.19 in /hail/python/dev …
dependabot[bot] Sep 9, 2022
22a0d3d
[batch] Remove lint errors from test_batch and test_accounts (#12147)
daniel-goldstein Sep 9, 2022
4f84fd2
[query] Fix handle_randomness for `collect_cols_by_key` (#12162)
tpoterba Sep 10, 2022
1f3de95
[query] Stage IndexReader (#12159)
tpoterba Sep 10, 2022
1a42362
[query] remove incompatibilities with java 11 (#12171)
iris-garden Sep 10, 2022
ab5569b
Revert "Retry GCS GetOjectStream.read automatically (#12098)" (#12176)
daniel-goldstein Sep 12, 2022
6d3413a
[utils] Add invalid grant to python retry-once errors (#12170)
daniel-goldstein Sep 12, 2022
895ed7c
[query] implement bit_count operation (#12168)
iris-garden Sep 13, 2022
9d84c5d
[query] Add better error to CastMatrixToTable length check (#12178)
tpoterba Sep 13, 2022
77514d3
[query] Fix lowering of aggs to preserve free variables in init args …
tpoterba Sep 13, 2022
5a68c29
Bump black from 22.3.0 to 22.8.0 in /hail/python/dev (#12174)
dependabot[bot] Sep 13, 2022
b759201
Merge remote-tracking branch 'upstream/main' into v0.2.98-upstream3
vladsavelyev Sep 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion batch/batch/cloud/azure/driver/pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def managed_disk_prices_by_region(
prices: List[AzureDiskPrice] = []
seen_disk_names: Dict[str, str] = {}

filter = f'serviceName eq \'Storage\' and armRegionName eq \'{region}\' and endswith(meterName,\'Disks\')'
filter = f'serviceName eq \'Storage\' and armRegionName eq \'{region}\' and ( endswith(meterName,\'Disk\') or endswith(meterName,\'Disks\') )'
async for data in pricing_client.list_prices(filter=filter):
if data['type'] != 'Consumption' or data['productName'] == 'Premium Page Blob':
continue
Expand Down
10 changes: 9 additions & 1 deletion batch/batch/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ class ImageNotFound(Exception):
pass


class InvalidImageRepository(Exception):
pass


class Image:
def __init__(
self,
Expand Down Expand Up @@ -441,6 +445,8 @@ async def _pull_image(self):
raise ImageCannotBePulled from e
if 'not found: manifest unknown' in e.message:
raise ImageNotFound from e
if 'Invalid repository name' in e.message:
raise InvalidImageRepository from e
raise

image_config, _ = await check_exec_output('docker', 'inspect', self.image_ref_str)
Expand Down Expand Up @@ -580,7 +586,7 @@ def user_error(e):
# bucket name and your credentials.\n')
if b'Bad credentials for bucket' in e.stderr:
return True
if isinstance(e, (ImageNotFound, ImageCannotBePulled)):
if isinstance(e, (ImageNotFound, ImageCannotBePulled, InvalidImageRepository)):
return True
if isinstance(e, (ContainerTimeoutError, ContainerDeletedError)):
return True
Expand Down Expand Up @@ -671,6 +677,8 @@ async def create(self):
self.short_error = 'image not found'
elif isinstance(e, ImageCannotBePulled):
self.short_error = 'image cannot be pulled'
elif isinstance(e, InvalidImageRepository):
self.short_error = 'image repository is invalid'

self.state = 'error'
self.error = traceback.format_exc()
Expand Down
6 changes: 3 additions & 3 deletions batch/test/failure_injecting_client_session.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import aiohttp

from hailtop.httpx import client_session
from hailtop import httpx
from hailtop.utils import async_to_blocking


class FailureInjectingClientSession:
class FailureInjectingClientSession(httpx.ClientSession):
def __init__(self, should_fail):
self.should_fail = should_fail
self.real_session = client_session()
self.real_session = httpx.client_session()

def __enter__(self):
return self
Expand Down
76 changes: 38 additions & 38 deletions batch/test/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ async def test_bad_token():
token = session_id_encode_to_str(secrets.token_bytes(32))
bc = await BatchClient.create('test', _token=token)
try:
b = bc.create_batch()
j = b.create_job(DOCKER_ROOT_IMAGE, ['false'])
await b.submit()
bb = bc.create_batch()
bb.create_job(DOCKER_ROOT_IMAGE, ['false'])
b = await bb.submit()
assert False, str(await b.debug_info())
except aiohttp.ClientResponseError as e:
assert e.status == 401, str((e, await b.debug_info()))
assert e.status == 401
finally:
await bc.close()

Expand Down Expand Up @@ -398,11 +398,11 @@ async def test_billing_limit_zero(

try:
bb = client.create_batch()
batch = await bb.submit()
b = await bb.submit()
except aiohttp.ClientResponseError as e:
assert e.status == 403 and 'has exceeded the budget' in e.message, str(await batch.debug_info())
assert e.status == 403 and 'has exceeded the budget' in e.message
else:
assert False, str(await batch.debug_info())
assert False, str(await b.debug_info())


async def test_billing_limit_tiny(
Expand Down Expand Up @@ -531,90 +531,90 @@ async def test_batch_cannot_be_accessed_by_users_outside_the_billing_project(
assert r['billing_project'] == project

user1_client = await make_client(project)
b = user1_client.create_batch()
j = b.create_job(DOCKER_ROOT_IMAGE, command=['sleep', '30'])
b_handle = await b.submit()
bb = user1_client.create_batch()
j = bb.create_job(DOCKER_ROOT_IMAGE, command=['sleep', '30'])
b = await bb.submit()

user2_client = dev_client
user2_batch = Batch(user2_client, b_handle.id, b_handle.attributes, b_handle.n_jobs, b_handle.token)
user2_batch = Batch(user2_client, b.id, b.attributes, b.n_jobs, b.token)

try:
try:
await user2_client.get_batch(b_handle.id)
await user2_client.get_batch(b.id)
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info)
assert False, str(await b.debug_info())

try:
await user2_client.get_job(j.batch_id, j.job_id)
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

try:
await user2_client.get_job_log(j.batch_id, j.job_id)
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

try:
await user2_client.get_job_attempts(j.batch_id, j.job_id)
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

try:
await user2_batch.status()
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

try:
await user2_batch.cancel()
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

try:
await user2_batch.delete()
except aiohttp.ClientResponseError as e:
assert e.status == 404, str((e, await b_handle.debug_info()))
assert e.status == 404, str((e, await b.debug_info()))
else:
assert False, str(await b_handle.debug_info())
assert False, str(await b.debug_info())

# list batches results for user2
found, batches = await search_batches(user2_client, b_handle.id, q='')
assert not found, str((b_handle.id, batches, await b_handle.debug_info()))
found, batches = await search_batches(user2_client, b.id, q='')
assert not found, str((b.id, batches, await b.debug_info()))

found, batches = await search_batches(user2_client, b_handle.id, q=f'billing_project:{project}')
assert not found, str((b_handle.id, batches, await b_handle.debug_info()))
found, batches = await search_batches(user2_client, b.id, q=f'billing_project:{project}')
assert not found, str((b.id, batches, await b.debug_info()))

found, batches = await search_batches(user2_client, b_handle.id, q='user:test')
assert not found, str((b_handle.id, batches, await b_handle.debug_info()))
found, batches = await search_batches(user2_client, b.id, q='user:test')
assert not found, str((b.id, batches, await b.debug_info()))

found, batches = await search_batches(user2_client, b_handle.id, q=None)
assert not found, str((b_handle.id, batches, await b_handle.debug_info()))
found, batches = await search_batches(user2_client, b.id, q=None)
assert not found, str((b.id, batches, await b.debug_info()))

found, batches = await search_batches(user2_client, b_handle.id, q='user:test-dev')
assert not found, str((b_handle.id, batches, await b_handle.debug_info()))
found, batches = await search_batches(user2_client, b.id, q='user:test-dev')
assert not found, str((b.id, batches, await b.debug_info()))

finally:
await b_handle.delete()
await b.delete()


async def test_deleted_open_batches_do_not_prevent_billing_project_closure(
make_client: Callable[[str], Awaitable[BatchClient]],
dev_client: BatchClient,
random_billing_project_name: Callable[[], str],
):
project = await dev_client.create_billing_project(random_billing_project_name)
try:
project = await dev_client.create_billing_project(random_billing_project_name)
await dev_client.add_user('test', project)
client = await make_client(project)
open_batch = await client.create_batch()._open_batch()
Expand Down
Loading