Uploaded image for project: 'Common Controller SDK'
  1. Common Controller SDK
  2. CCSDK-1855

Improve Remote Python Executor error handling and allow for structured response

XMLWordPrintable

    • Frankfurt Sp1: 11/4 - 11/22

      Remote Python Executor component previously only returned logs of the script execution,  and did not catch errors systematically, making it difficult to reliably decide if execution should continue.   Sometimes, there is also a need to return a structured payload that is produced in the script.   This task addressed these shortcomings.

      • component definition updated to have a required status output attribute.  Implementation will now systematically be populated with either SUCCESS of FAILURE as per the True or False response of the script executed, by the remote python executor.
      • component implementation will now populate the optional field response-data with a JSON payload that is returned by the script, using a new Python utility function, (automatically installed in all remote python environments) called send_response_data_payload().

      The component will automatically populate the output attribute response-data with this payload.

      PREREQUISITES
      Import the utility script, like so :
      from cds_utils.payload_coder import send_response_data_payload
      in any script that will call the function send_response_data_payload

       
      USAGE
      The script should call the utility function before returning.
      It can be anywhere in the script.

      Example :
      if name == 'main':

      status = commit(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
      if DEBUG:
          print("commit function returned with status : %s" % status)
      if status:
          send_response_data_payload({"étudiant": ["Mélanie", "Joséphine"]})

      sys.exit(status)

       

            agileone agileone
            agileone agileone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: