Scripting

 View Only
  • 1.  Running XMC workflow scripts in pc for testing

    Posted 01-06-2022 17:02

    Hi,

    I'm creating some workflows in XMC and I would like to run them on my PC first just for testing.

    Is there a class or functions that I can import just to simulate the script and check for errors, even if it is just syntax error, before running it on the XMC?

     

    Regards,

    José Chaves



  • 2.  RE: Running XMC workflow scripts in pc for testing
    Best Answer

    Posted 01-07-2022 03:35
      |   view attached
    Actually, that is what I do when I write XMC/XIQ-SE Python scripts (or individual workflow Python activities).
    I have this code at the beginning of my code:

    ##########################################################
    try:
        emc_vars
        execution = 'xmc'
    except: # If not running on XMC Jython...
        # These lines only needed to run XMC Python script locally (on my laptop)
        # They can also be pasted to XMC, but will not execute
        import sys
        import json
        import java.util
        import emc_cli      # Own local replica
        import emc_nbi      # Own local replica
        import emc_results  # Own local replica
        execution = 'dev'
        if len(sys.argv) > 1: # Json file as 1st argv
            emc_vars = json.load(open(sys.argv[1]))
        else:
            emc_vars = json.load(open('emc_vars.json'))
    ##########################################################
    

    And I use the attached bogus classes which simply read the emc_vars or CLI command output directly from a json file I edit.

    Attachment(s)

    zip
    emc_localclasses.zip   20 KB 1 version


  • 3.  RE: Running XMC workflow scripts in pc for testing

    Posted 01-07-2022 05:04
    Hi,

    The file is password protected.

    Regards,
    José Chaves


  • 4.  RE: Running XMC workflow scripts in pc for testing

    Posted 01-07-2022 05:12
    Password is "emc"
    Need to set that when emailing it, else it gets clobbered by email virus checking!


  • 5.  RE: Running XMC workflow scripts in pc for testing

    Posted 01-07-2022 06:25

    Thanks, Ludovico

     

    That is exactly what I was looking for.

    Regards,
    José Chaves