none
HPC 2016.1 REST API Documentation RRS feed

  • Question

  • Is there any documentation for the new JSON REST api?

    Specifically, I'm trying to figure out the correct way to post data to create a new job.

    Using the obvious dict of properties - e.g.

    data = {'Name': 'TestJob'}

    ...doesn't work. The job is created but it doesn't have the specified name TestJob - the Job Name field is blank.

    Whats' the correct way to pass properties to the new JSON REST api?

    Thanks,

    Dave

    Monday, January 22, 2018 12:48 AM

All replies

  • Are there any logs for the web api where I might find out what is going wrong? If so, where would I find them?

    Thanks,

    Dave

    Monday, January 22, 2018 1:48 AM
  • Also, what's the correct api version to be using for HPC Pack 2016 Update 1?
    I'm currently using the below which I found in the "New Set of HPC Pack Scheduler REST API" pdf

    headers={"api-version": "2016-11-01.5.0"}

    Monday, January 22, 2018 2:03 AM
  • Through a process of trial-and-error I've found the correct format of the JSON properties to be below:
    kwargs = dict(
        auth=HttpNegotiateAuth(),
        headers={"api-version": "2016-11-01.5.0"},
        verify=False,
    )
    properties = [
        {'Name': 'Name', 'Value': 'PythonTest'}
    ]
    url = f"https://{os.environ['CCP_SCHEDULER']}/hpc/jobs"
    resp = requests.post(url, json=properties, **kwargs)
    resp.raise_for_status()
    job_id = resp.json()

    Even some basic/unfinished/dev documentation would be helpful!
    Monday, January 22, 2018 2:40 AM
  • Hi,

      We understand the poor documentation. And this is one of the top thing we are tackling within the next several months.


    Qiufang Shi

    Monday, January 22, 2018 9:43 AM