mlbench / mlbench-dashboard

MLBench Dashboard
https://mlbench.github.io
Apache License 2.0
1 stars 1 forks source link

Prevent user from inserting invalid run names #28

Closed giorgiosav closed 4 years ago

giorgiosav commented 4 years ago

When a user inserts an invalid name for a run, the run immediately errors out with this message (in my case, the name contained a space). It would be nice to prevent the run from starting if the name is invalid.

Run failed
Traceback (most recent call last):
  File "/app/code/api/utils/run_utils.py", line 311, in run_model_job
    set_name = create_statefulset(model_run, release_name, ns, job)
  File "/app/code/api/utils/run_utils.py", line 154, in create_statefulset
    response = core.create_namespaced_service(namespace, service)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/apis/core_v1_api.py", line 6820, in create_namespaced_service
    (data) = self.create_namespaced_service_with_http_info(namespace, body, **kwargs)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/apis/core_v1_api.py", line 6905, in create_namespaced_service_with_http_info
    collection_formats=collection_formats)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 321, in call_api
    _return_http_data_only, collection_formats, _preload_content, _request_timeout)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 155, in __call_api
    _request_timeout=_request_timeout)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 364, in request
    body=body)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/rest.py", line 266, in POST
    body=body)
  File "/venv/lib/python3.6/site-packages/kubernetes/client/rest.py", line 222, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': '778e2803-be7a-4c4f-bf72-477cb1f53ec6', 'Content-Type': 'application/json', 'Date': 'Sun, 17 May 2020 16:04:49 GMT', 'Transfer-Encoding': 'chunked'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Service \"linear py14-mlbench-worker-giorgio-3\" is invalid: [metadata.name: Invalid value: \"linear py14-mlbench-worker-giorgio-3\": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?'), metadata.labels: Invalid value: \"linear py14\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?'), spec.selector: Invalid value: \"linear py14\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')]","reason":"Invalid","details":{"name":"linear py14-mlbench-worker-giorgio-3","kind":"Service","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"linear py14-mlbench-worker-giorgio-3\": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')","field":"metadata.name"},{"reason":"FieldValueInvalid","message":"Invalid value: \"linear py14\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')","field":"metadata.labels"},{"reason":"FieldValueInvalid","message":"Invalid value: \"linear py14\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')","field":"spec.selector"}]},"code":422}