Skip to content

Fixed Failed Kokoro Test (Dataproc) #1203

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

Merged
merged 11 commits into from
Nov 8, 2017
5 changes: 1 addition & 4 deletions dataproc/dataproc_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@

import os

from gcp_devrel.testing.flaky import flaky

import submit_job_to_cluster

PROJECT = os.environ['GCLOUD_PROJECT']
BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
CLUSTER_NAME = 'testcluster2'
CLUSTER_NAME = 'testcluster3'
ZONE = 'us-central1-b'


@flaky
def test_e2e():
output = submit_job_to_cluster.main(
PROJECT, ZONE, CLUSTER_NAME, BUCKET)
Expand Down
12 changes: 10 additions & 2 deletions dataproc/submit_job_to_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
def get_default_pyspark_file():
"""Gets the PySpark file from this directory"""
current_dir = os.path.dirname(os.path.abspath(__file__))
f = open(os.path.join(current_dir, DEFAULT_FILENAME), 'r')
f = open(os.path.join(current_dir, DEFAULT_FILENAME), 'rb')
return f, DEFAULT_FILENAME


def get_pyspark_file(filename):
f = open(filename, 'r')
f = open(filename, 'rb')
return f, os.path.basename(filename)


Expand Down Expand Up @@ -76,6 +76,14 @@ def create_cluster(dataproc, project, zone, region, cluster_name):
'config': {
'gceClusterConfig': {
'zoneUri': zone_uri
},
'masterConfig': {
'numInstances': 1,
'machineTypeUri': 'n1-standard-1'
},
'workerConfig': {
'numInstances': 2,
'machineTypeUri': 'n1-standard-1'
}
}
}
Expand Down