Skip to content

[webservice] Shorten error message in MyMDC reply

Cyril Danilevski requested to merge fix/mdc_error_update into master

Description

MyMDC accepts replies up to 2048 characters, which is too short to feed the whole command, but too long to be helpful.
We therefore decided to add only a short message directed to users, as we have all the information logged.

Unrelated tidbit: don't put emojis in MyMDC messages: that generates an http 500 (internal error)

How Has This Been Tested?

This was tested outside of the webservice with this code:

from config import webservice as config
from messages import Errors
from metadata_client.metadata_client import MetadataClient


mdconf = config['metadata-client']
client_conn = MetadataClient(client_id=mdconf['user-id'],
                             client_secret=mdconf['user-secret'],
                             user_email=mdconf['user-email'],
                             token_url=mdconf['token-url'],
                             refresh_url=mdconf['refresh-url'],
                             auth_url=mdconf['auth-url'],
                             scope=mdconf['scope'],
                             base_api_url=mdconf['base-api-url'])


msg = Errors.JOB_LAUNCH_FAILED.format('🚀'*2049, 1)
ret = client_conn.update_run_api(63606, {'cal_pipeline_reply': msg})
print(ret)  # http 422

msg = Errors.JOB_LAUNCH_FAILED.format('internal error', 1)
ret = client_conn.update_run_api(63606, {'cal_pipeline_reply': msg})
print(ret)  # http 200

Relevant Documents (optional)

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.

Reviewers

@schmidtp @roscar

Merge request reports