I started using the Machine Learning Engine API for terminal and python and I discovered some discrepancies between the bash API and python API:
$ gcloud ml-engine jobs list --filter='jobId:eval_*'
JOB_ID STATUS CREATED
eval_chest_frontal_golden_201903 SUCCEEDED 2019-03-12T14:35:50
... (30 other results)
and in python:
from oauth2client.client import GoogleCredentials
from googleapiclient import discovery
from googleapiclient import errors
ml = discovery.build('ml', 'v1')
request = ml.projects().jobs().list(
parent="<<<PROJECT_NAME_HERE>>>",
filter="jobId:eval_*")
response = None
try:
response = request.execute()
except errors.HttpError as err:
raise Exception("Request failed!")
print(response)
# Prints: {}
I looked at the API explorer with the same parameters:
https://developers.google.com/apis-explorer/#p/ml/v1/ml.projects.jobs.list
I get the same result as in python: {}
but it looks like the URL is not escaping the *
in https://.../jobs?filter=jobId%3Aeval_*&key=...
. Maybe that is the bug. Any way I can fix this in the python API?
Just figured out you can use this filter instead: "jobId:eval_"
. Like below:
request = ml.projects().jobs().list(
parent="<<<PROJECT_NAME_HERE>>>",
filter="jobId:eval_")
and has the same effect as "jobId:eval_*"
.
The only concern is that Google will deprecate that feature in the future:
WARNING: --filter : operator evaluation is changing for consistency across Google APIs.
jobId:eval_
currently matches but will not match in the near future. Rungcloud topic filters
for details.