Ejemplo n.º 1
0
def main(args, pass_through_args):  # pylint: disable=unused-argument
    userinfo = get_userinfo()
    result = {
        'username': userinfo['username'],
        'email': userinfo['email'],
        'gsa_email': userinfo['gsa_email']
    }
    print(json.dumps(result, indent=4))
Ejemplo n.º 2
0
def main(args, pass_through_args):  # pylint: disable=unused-argument
    userinfo = get_userinfo()
    if userinfo is None:
        print('not logged in')
        sys.exit(1)
    result = {
        'username': userinfo['username'],
        'email': userinfo['email'],
        'gsa_email': userinfo['gsa_email']
    }
    print(json.dumps(result, indent=4))
Ejemplo n.º 3
0
def main(args, pass_through_args):  # pylint: disable=unused-argument
    userinfo = get_userinfo()
    if userinfo is None:
        print('not logged in')
        sys.exit(1)
    result = {
        'username': userinfo['username'],
        'email': userinfo['email'],
        'gsa_email':
        userinfo['hail_identity'],  # deprecated - backwards compatibility
        'hail_identity': userinfo['hail_identity'],
    }
    print(json.dumps(result, indent=4))
Ejemplo n.º 4
0
def test_input_dependency(client):
    user = get_userinfo()
    batch = client.create_batch()
    head = batch.create_job(
        'ubuntu:18.04',
        command=[
            '/bin/sh', '-c', 'echo head1 > /io/data1 ; echo head2 > /io/data2'
        ],
        output_files=[('/io/data*', f'gs://{user["bucket_name"]}')])
    tail = batch.create_job(
        'ubuntu:18.04',
        command=['/bin/sh', '-c', 'cat /io/data1 ; cat /io/data2'],
        input_files=[(f'gs://{user["bucket_name"]}/data*', '/io/')],
        parents=[head])
    batch.submit()
    tail.wait()
    assert head._get_exit_code(head.status(), 'main') == 0, head._status
    assert tail.log()['main'] == 'head1\nhead2\n', tail.status()
Ejemplo n.º 5
0
def test_input_dependency_directory(client):
    user = get_userinfo()
    batch = client.create_batch()
    head = batch.create_job(
        'alpine:3.8',
        command=[
            '/bin/sh', '-c',
            'mkdir -p /io/test/; echo head1 > /io/test/data1 ; echo head2 > /io/test/data2'
        ],
        output_files=[('/io/test/', f'gs://{user["bucket_name"]}')])
    tail = batch.create_job(
        'alpine:3.8',
        command=['/bin/sh', '-c', 'cat /io/test/data1 ; cat /io/test/data2'],
        input_files=[(f'gs://{user["bucket_name"]}/test', '/io/')],
        parents=[head])
    batch.submit()
    tail.wait()
    assert head.status()['exit_code']['main'] == 0, head._status
    assert tail.log()['main'] == 'head1\nhead2\n', tail.status()
Ejemplo n.º 6
0
 def setUp(self):
     self.backend = ServiceBackend()
     bucket_name = get_userinfo()['bucket_name']
     token = uuid.uuid4()
     self.gcs_input_dir = f'gs://{bucket_name}/batch-tests/resources'
     self.gcs_output_dir = f'gs://{bucket_name}/batch-tests/{token}'
     in_cluster_key_file = '/test-gsa-key/key.json'
     if os.path.exists(in_cluster_key_file):
         credentials = google.oauth2.service_account.Credentials.from_service_account_file(
             in_cluster_key_file)
     else:
         credentials = None
     gcs_client = google.cloud.storage.Client(project='hail-vdc', credentials=credentials)
     bucket = gcs_client.bucket(bucket_name)
     if not bucket.blob('batch-tests/resources/hello (foo) spaces.txt').exists():
         bucket.blob('batch-tests/resources/hello.txt').upload_from_string(
             'hello world')
         bucket.blob('batch-tests/resources/hello spaces.txt').upload_from_string(
             'hello')
         bucket.blob('batch-tests/resources/hello (foo) spaces.txt').upload_from_string(
             'hello')
Ejemplo n.º 7
0
    def __init__(self, billing_project=None, bucket=None):
        if billing_project is None:
            billing_project = get_user_config().get('batch', 'billing_project', fallback=None)
        if billing_project is None:
            raise ValueError(
                f'the billing_project parameter of ServiceBackend must be set '
                f'or run `hailctl config set batch/billing_project '
                f'MY_BILLING_PROJECT`')
        self._batch_client = BatchClient(billing_project)

        if bucket is None:
            bucket = get_user_config().get('batch', 'bucket', fallback=None)
        if bucket is None:
            userinfo = get_userinfo()
            bucket = userinfo.get('bucket_name')
        if bucket is None:
            raise ValueError(
                f'the bucket parameter of ServiceBackend must be set '
                f'or run `hailctl config set batch/bucket '
                f'MY_BUCKET`')
        self._bucket_name = bucket
Ejemplo n.º 8
0
from hailtop.auth import get_userinfo

GITHUB_CLONE_URL = 'https://github.com/'
GITHUB_STATUS_CONTEXT = 'ci-test'

userinfo = get_userinfo()
BUCKET = f'gs://{userinfo["bucket_name"]}'

AUTHORIZED_USERS = {
    'danking', 'cseed', 'konradjk', 'jigold', 'patrick-schultz', 'lfrancioli',
    'akotlar', 'tpoterba', 'chrisvittal', 'catoverdrive', 'GreatBrando',
    'johnc1231', 'gsarma', 'mkveerapen'
}