-
Notifications
You must be signed in to change notification settings - Fork 5
Azure-compatibility #610
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
base: main
Are you sure you want to change the base?
Azure-compatibility #610
Changes from 4 commits
c87f4b8
3cf6863
22501b1
133bc66
1e16b40
adf9663
d5ebf93
350d1d1
9af914e
ac4effb
9d78ebc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "location": "external", | ||
| "default_namespace": "default", | ||
| "domain": "azhail.populationgenomics.org.au" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "location": "external", | ||
| "default_namespace": "default", | ||
| "domain": "hail.populationgenomics.org.au" | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,18 @@ | |||||||||||||||||||||||||||||||
| MEMBERS_CACHE_LOCATION = os.getenv('MEMBERS_CACHE_LOCATION') | ||||||||||||||||||||||||||||||||
| assert MEMBERS_CACHE_LOCATION | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| CONFIG_PATH_PREFIXES = {'gcp': 'gs://cpg-config'} | ||||||||||||||||||||||||||||||||
| SUPPORTED_CLOUD_ENVIRONMENTS = {'gcp', 'azure'} | ||||||||||||||||||||||||||||||||
| DEFAULT_CLOUD_ENVIRONMENT = 'gcp' | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| DEPLOY_CONFIG_PATHS = { | ||||||||||||||||||||||||||||||||
| 'gcp': '/deploy-config/deploy-config-gcp.json', | ||||||||||||||||||||||||||||||||
| 'azure': '/deploy-config/deploy-config-azure.json' | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| CONFIG_PATH_PREFIXES = { | ||||||||||||||||||||||||||||||||
| 'gcp': 'gs://cpg-config', | ||||||||||||||||||||||||||||||||
| 'azure': 'az://cpgcommon/cpg-config' | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| secret_manager = secretmanager.SecretManagerServiceClient() | ||||||||||||||||||||||||||||||||
| publisher = pubsub_v1.PublisherClient() | ||||||||||||||||||||||||||||||||
|
|
@@ -46,7 +57,7 @@ def get_server_config() -> dict: | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async def _get_hail_version(environment: str) -> str: | ||||||||||||||||||||||||||||||||
| """ASYNC get hail version for the hail server in the local deploy_config""" | ||||||||||||||||||||||||||||||||
| if not environment == 'gcp': | ||||||||||||||||||||||||||||||||
| if environment not in SUPPORTED_CLOUD_ENVIRONMENTS: | ||||||||||||||||||||||||||||||||
| raise web.HTTPBadRequest( | ||||||||||||||||||||||||||||||||
| reason=f'Unsupported Hail Batch deploy config environment: {environment}' | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
@@ -110,13 +121,22 @@ def check_dataset_and_group(server_config, environment: str, dataset, email) -> | |||||||||||||||||||||||||||||||
| reason=f'Dataset {dataset} does not support the {environment} environment' | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # do this to check access-members cache | ||||||||||||||||||||||||||||||||
| gcp_project = dataset_config.get('gcp', {}).get('projectId') | ||||||||||||||||||||||||||||||||
| if environment == 'gcp': | ||||||||||||||||||||||||||||||||
| # do this to check access-members cache | ||||||||||||||||||||||||||||||||
| gcp_project = dataset_config.get('gcp', {}).get('projectId') | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if not gcp_project: | ||||||||||||||||||||||||||||||||
| raise web.HTTPBadRequest( | ||||||||||||||||||||||||||||||||
| reason=f'The analysis-runner does not support checking group members for the {environment} environment' | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| elif environment == 'azure': | ||||||||||||||||||||||||||||||||
| azure_resource_group = dataset_config.get('azure', {}).get('resourceGroup') | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if not azure_resource_group: | ||||||||||||||||||||||||||||||||
| raise web.HTTPBadRequest( | ||||||||||||||||||||||||||||||||
| reason=f'The analysis-runner does not support checking group members for the {environment} environment' | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove this, group member checks are not in secrets, therefore no gcp_project ID is needed anymore (I think):
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if not gcp_project: | ||||||||||||||||||||||||||||||||
| raise web.HTTPBadRequest( | ||||||||||||||||||||||||||||||||
| reason=f'The analysis-runner does not support checking group members for the {environment} environment' | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| if not is_member_in_cached_group( | ||||||||||||||||||||||||||||||||
| f'{dataset}-analysis', email, members_cache_location=MEMBERS_CACHE_LOCATION | ||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||
|
|
@@ -148,7 +168,12 @@ def get_analysis_runner_metadata( | |||||||||||||||||||||||||||||||
| Get well-formed analysis-runner metadata, requiring the core listed keys | ||||||||||||||||||||||||||||||||
| with some flexibility to provide your own keys (as **kwargs) | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| output_dir = f'gs://cpg-{dataset}-{cpg_namespace(access_level)}/{output_prefix}' | ||||||||||||||||||||||||||||||||
| if environment == 'gcp': | ||||||||||||||||||||||||||||||||
| output_dir = f'gs://cpg-{dataset}-{cpg_namespace(access_level)}/{output_prefix}' | ||||||||||||||||||||||||||||||||
| elif environment == 'azure': | ||||||||||||||||||||||||||||||||
| # TODO: need a way for analysis runner to know where to save metadata | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| prefix = CONFIG_PATH_PREFIXES.get(environment) | ||||||||||||||||||||||||||||||||
| output_dir = AnyPath(prefix) / | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| 'timestamp': timestamp, | ||||||||||||||||||||||||||||||||
|
|
@@ -228,8 +253,6 @@ def get_baseline_run_config( | |||||||||||||||||||||||||||||||
| baseline_config = { | ||||||||||||||||||||||||||||||||
| 'hail': { | ||||||||||||||||||||||||||||||||
| 'billing_project': dataset, | ||||||||||||||||||||||||||||||||
| # TODO: how would this work for Azure | ||||||||||||||||||||||||||||||||
| 'bucket': f'cpg-{dataset}-hail', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| 'workflow': { | ||||||||||||||||||||||||||||||||
| 'access_level': access_level, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| Simple script to test whether the CPG infrastructure and permissions are | ||
| configured appropriately to permit running AIP. | ||
| """ | ||
|
|
||
| import click | ||
|
|
||
| from cpg_utils.config import get_config | ||
| from cpg_utils.hail_batch import remote_tmpdir | ||
| import hailtop.batch as hb | ||
|
|
||
|
|
||
| @click.command() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a couple of test workflows in |
||
| def main(): | ||
| """ | ||
| main | ||
| """ | ||
|
|
||
| service_backend = hb.ServiceBackend( | ||
| billing_project=get_config()['hail']['billing_project'], | ||
| remote_tmpdir=remote_tmpdir(), | ||
| ) | ||
| batch = hb.Batch( | ||
| name='Test CPG Infra', | ||
| backend=service_backend, | ||
| cancel_after_n_failures=1, | ||
| default_timeout=6000, | ||
| default_memory='highmem', | ||
| ) | ||
|
|
||
| j = batch.new_job(name='Write the file') | ||
| j.command(f'echo "Hello World." > {j.ofile}') | ||
|
|
||
| k = batch.new_job(name='Read the file') | ||
| k.command(f'cat {j.ofile}') | ||
|
|
||
| batch.run(wait=False) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() # pylint: disable=E1120 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| [buckets] | ||
| web_suffix = "web" | ||
| tmp_suffix = "tmp" | ||
| analysis_suffix = "analysis" | ||
|
|
||
| [workflow] | ||
| dataset = "thousand-genomes" | ||
| access_level = "test" | ||
| dataset_path = "cpgthousandgenomes/test" | ||
| output_prefix = "output" | ||
| path_scheme = "az" | ||
| image_registry_prefix = "cpgcommonimages.azurecr.io" | ||
|
|
||
| [hail] | ||
| billing_project = "fewgenomes" | ||
| bucket = "az://cpgthousandgenomes/test" | ||
|
|
||
| [images] | ||
| hail = "hailgenetics/hail:0.2.93" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
|
|
||
| analysis-runner \ | ||
| --dataset thousand-genomes \ | ||
| --description 'Test script for batch on Azure' \ | ||
| --output-dir test \ | ||
| --cloud azure \ | ||
| --access-level test \ | ||
| --config test/hail_batch_job.toml \ | ||
| --image cpg_workflows:latest \ | ||
| test/test_cpg_infra.py \ | ||
| test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we omit instead of provide a default? Which lets the analysis-runner decide the default