|
9 | 9 | import sys |
10 | 10 | from threading import Timer |
11 | 11 |
|
12 | | -from packaging import version |
| 12 | +import pkg_resources |
13 | 13 | from absl import flags |
14 | 14 | from absl.testing import parameterized |
15 | 15 |
|
@@ -252,7 +252,7 @@ def getImageVersion(): |
252 | 252 | # Special case a 'preview' image versions and return a large number |
253 | 253 | # instead to make it a higher image version in comparisons |
254 | 254 | version = FLAGS.image_version |
255 | | - return version.parse('999') if version.startswith( |
| 255 | + return pkg_resources.parse_version('999') if version.startswith( |
256 | 256 | 'preview') else pkg_resources.parse_version(version.split('-')[0]) |
257 | 257 |
|
258 | 258 | @staticmethod |
@@ -307,21 +307,23 @@ def assert_dataproc_job(self, |
307 | 307 |
|
308 | 308 | Args: |
309 | 309 | cluster_name: cluster name to submit job to |
310 | | - job_type: type of the job, e.g. spark, hadoop, pyspark |
311 | | - job_params: job parameters |
312 | | - timeout_in_minutes: timeout in minutes |
| 310 | + job_type: job type (hadoop, spark, etc) |
| 311 | + job_params: job command parameters |
| 312 | + timeout_in_minutes: timeout in minutes after which process that |
| 313 | + waits on job will be killed if job did not |
| 314 | + finish |
| 315 | + Returns: |
| 316 | + ret_code: the return code of the job |
| 317 | + stdout: standard output of the job |
| 318 | + stderr: error output of the job |
313 | 319 | Raises: |
314 | 320 | AssertionError: if job returned non-0 exit code. |
315 | 321 | """ |
316 | 322 |
|
317 | | - ret_code, stdout, stderr = DataprocTestCase.run_command( |
| 323 | + ret_code, stdout, stderr = self.assert_command( |
318 | 324 | 'gcloud dataproc jobs submit {} --cluster={} --region={} {}'. |
319 | 325 | format(job_type, cluster_name, self.REGION, |
320 | 326 | job_params), timeout_in_minutes) |
321 | | - self.assertEqual( |
322 | | - ret_code, 0, |
323 | | - "Job failed with code {}. stdout: {}. stderr: {}".format( |
324 | | - ret_code, stdout, stderr)) |
325 | 327 | return ret_code, stdout, stderr |
326 | 328 |
|
327 | 329 | def assert_command(self, cmd, timeout_in_minutes=DEFAULT_TIMEOUT): |
|
0 commit comments