tapis-project / tapis-apps

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Apps: patchApp does not apply envVariable updates. #40

Closed scblack321 closed 1 year ago

scblack321 commented 1 year ago

Reported by Garret Edmonds via slack on 6/13/2023

Garrett Edmonds 11:09 AM Hey y'all! I was trying to use the tapipy patchApp function yesterday to update the envVariables subfield of an app defintion, and after using it successfully (function returned a URL), I would look at the app definition via getApp and showed that the definition did not change. Sal, Frank, and Chandra let me know I could get this done with putApp instead, but I thought i'd note it here too.

Example PATCH request:

{
  "appArgs": [],
  "containerArgs": [
      {
          "name": "Interactive Session and TACC Module Mounts",
          "description": "Mount the required folders in order for TAP, DCV, VNC, and TACC modules to function.",
          "inputMode": "FIXED",
          "arg": "--bind /bin,/etc,/home1/apps,/lib,/lib64,/opt,/run,/share,/usr,/var"
      }
  ],
  "schedulerOptions": [
     {
         "name": "TACC Scheduler Profile",
         "description": "Scheduler profile for HPC clusters at TACC",
         "inputMode": "FIXED",
         "arg": "--tapis-profile tacc-apptainer"
     },
     {
       "name": "TACC Interactive Session Substrings",
        "description": "VNC and DCV sessions require the substrings 'tap_' and '-dcvserver' in the slurm job name in order to function.",
        "inputMode": "FIXED",
        "arg": "--job-name ${JobName}-dcvserver-tap_"
     }
     ],
     "envVariables": [
     {
       "key": "_XTERM_CMD",
        "value": "sleep 20m",
         "description": "Command passed to XTERM, launched within the interactive session."
      },
      {
         "key": "APPEND_PATH",
          "value": "$PATH",
          "description": "Append host $PATH to Singularity container default $PATH."
      }
   ],
   "archiveFilter": {
    "includes": [],
     "excludes": [],
     "includeLaunchFiles": true
   }
}

Original App definition:

{
    "id": "rstudio",
    "version": "4.3.0",
    "description": "Run an interactive RStudio Desktop session on Frontera.",
    "owner": "${apiUserId}",
    "enabled": true,
    "runtime": "SINGULARITY",
    "runtimeVersion": null,
    "runtimeOptions": [
        "SINGULARITY_RUN"
    ],
    "containerImage": "docker://taccaci/rstudio:4.3.0",
    "jobType": "BATCH",
    "maxJobs": -1,
    "maxJobsPerUser": -1,
    "strictFileInputs": true,
    "jobAttributes": {
        "description": "Run an interactive RStudio Desktop session on Frontera.",
        "dynamicExecSystem": false,
        "execSystemConstraints": null,
        "execSystemId": "frontera",
        "execSystemExecDir": "${JobWorkingDir}",
        "execSystemInputDir": "${JobWorkingDir}",
        "execSystemOutputDir": "${JobWorkingDir}/output",
        "execSystemLogicalQueue": "development",
        "archiveSystemId": "cloud.data",
        "archiveSystemDir": "HOST_EVAL($HOME)/tapis-jobs-archive/${JobCreateDate}/${JobName}-${JobUUID}",
        "archiveOnAppError": true,
        "isMpi": false,
        "mpiCmd": null,
        "cmdPrefix": null,
        "parameterSet": {
            "appArgs": [],
            "containerArgs": [
                {
                    "name": "Interactive Session and TACC Module Mounts",
                    "description": "Mount the required folders in order for TAP, DCV, VNC, and TACC modules to function.",
                    "inputMode": "FIXED",
                    "arg": "--bind /bin,/etc,/home1/apps,/lib,/lib64,/opt,/run,/share,/usr,/var"
                }
            ],
            "schedulerOptions": [
                {
                    "name": "TACC Scheduler Profile",
                    "description": "Scheduler profile for HPC clusters at TACC",
                    "inputMode": "FIXED",
                    "arg": "--tapis-profile tacc-apptainer"
                },
                {
                    "name": "TACC Interactive Session Substrings",
                    "description": "VNC and DCV sessions require the substrings 'tap_' and '-dcvserver' in the slurm job name in order to function.",
                    "inputMode": "FIXED",
                    "arg": "--job-name ${JobName}-dcvserver-tap_"
                }
            ],
            "envVariables": [
                {
                    "key": "_XTERM_CMD",
                    "value": "/init",
                    "description": "Command passed to XTERM, launched within the interactive session."
                },
                {
                    "key": "APPEND_PATH",
                    "value": "$PATH",
                    "description": "Append host $PATH to Singularity container default $PATH."
                }
            ],
            "archiveFilter": {
                "includes": [],
                "excludes": [],
                "includeLaunchFiles": true
            }
        },
        "fileInputs": [],
        "fileInputArrays": [],
        "nodeCount": 1,
        "coresPerNode": 1,
        "memoryMB": 100,
        "maxMinutes": 120,
        "subscriptions": [],
        "tags": []
    },
    "tags": [
        "portalName: ALL"
    ],
    "notes": {
        "label": "RStudio (Frontera)",
        "helpUrl": "https://docs.posit.co/",
        "hideNodeCountAndCoresPerNode": false,
        "isInteractive": true,
        "icon": "rstudio",
        "category": "Data Processing"
    }
}
Patch json (referenced in command as **appDef['jobAttributes']['parameterSet']):
{
            "appArgs": [],
            "containerArgs": [
                {
                    "name": "Interactive Session and TACC Module Mounts",
                    "description": "Mount the required folders in order for TAP, DCV, VNC, and TACC modules to function.",
                    "inputMode": "FIXED",
                    "arg": "--bind /bin,/etc,/home1/apps,/lib,/lib64,/opt,/run,/share,/usr,/var"
                }
            ],
            "schedulerOptions": [
                {
                    "name": "TACC Scheduler Profile",
                    "description": "Scheduler profile for HPC clusters at TACC",
                    "inputMode": "FIXED",
                    "arg": "--tapis-profile tacc-apptainer"
                },
                {
                    "name": "TACC Interactive Session Substrings",
                    "description": "VNC and DCV sessions require the substrings 'tap_' and '-dcvserver' in the slurm job name in order to function.",
                    "inputMode": "FIXED",
                    "arg": "--job-name ${JobName}-dcvserver-tap_"
                }
            ],
            "envVariables": [
                {
                    "key": "_XTERM_CMD",
                    "value": "sleep 20m",
                    "description": "Command passed to XTERM, launched within the interactive session."
                },
                {
                    "key": "APPEND_PATH",
                    "value": "$PATH",
                    "description": "Append host $PATH to Singularity container default $PATH."
                }
            ],
            "archiveFilter": {
                "includes": [],
                "excludes": [],
                "includeLaunchFiles": true
            }
}
scblack321 commented 1 year ago

Unable to reproduce using curl. Either user error or related to tapipy usage.