unable to save the files generated through the container service plugin in xnat/resources

3 views
Skip to first unread message

Pasquale

unread,
Sep 10, 2025, 2:37:04 PM (3 days ago) Sep 10
to xnat_discussion

Hello everybody,

 i  have made some small modifications to the debug container json to understand how the container service works but i am facing some issues. The command is working and the result file is written to the build directory, but they are not uploaded to XNAT. 

this is the json file i was testing
{
  "name": "debug",
  "label": "debug",
  "description": "Runs a user-provided command",
  "version": "1.7",
  "schema-version": "1.0",
  "image": "xnat/debug-command:latest",
  "type": "docker",
  "command-line": "sh -c 'mkdir -p /output/xnat_out; chmod 755 /output/xnat_out; #COMMAND# > /output/xnat_out/out.txt 2>&1; chmod 666 /output/xnat_out/out.txt; sync; echo ---; echo Container sees:; ls -lR /output echo Listing /output; ls -lR /output'",
  "override-entrypoint": true,
  "mounts": [
    {
      "name": "in",
      "writable": false,
      "path": "/input"
    },
    {
      "name": "out",
      "writable": true,
      "path": "/output"
    }
  ],
  "environment-variables": {},
  "ports": {},
  "inputs": [
    {
      "name": "command",
      "description": "The command to run",
      "type": "string",
      "default-value": "echo hello world",
      "required": true,
      "replacement-key": "#COMMAND#",
      "select-values": []
    }
  ],
  "outputs": [
    {
      "name": "output",
      "description": "The command's stdout",
      "required": true,
      "mount": "out",
      "path": "xnat_out/out.txt"
    }
  ],
  "xnat": [
    {
      "name": "debug-project",
      "label": "Debug",
      "description": "Run the debug container with a project mounted",
      "contexts": [
        "xnat:projectData"
      ],
      "external-inputs": [
        {
          "name": "project",
          "description": "Input project",
          "type": "Project",
          "required": true,
          "provides-files-for-command-mount": "in",
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "project",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    },
    {
      "name": "debug-project-asset",
      "label": "Debug",
      "description": "Run the debug container with a project-asset mounted",
      "contexts": [
        "xnat:abstractProjectAsset"
      ],
      "external-inputs": [
        {
          "name": "project-asset",
          "description": "Input project asset",
          "type": "ProjectAsset",
          "required": true,
          "provides-files-for-command-mount": "in",
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "project-asset",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    },
    {
      "name": "debug-subject",
      "description": "Run the debug container with a subject mounted",
      "contexts": [
        "xnat:subjectData"
      ],
      "external-inputs": [
        {
          "name": "subject",
          "description": "Input subject",
          "type": "Subject",
          "required": true,
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "subject",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    },
    {
      "name": "debug-session",
      "label": "Debug",
      "description": "Run the debug container with a session mounted",
      "contexts": [
        "xnat:imageSessionData"
      ],
      "external-inputs": [
        {
          "name": "session",
          "description": "Input session",
          "type": "Session",
          "required": true,
          "provides-files-for-command-mount": "in",
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "session",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    },
    {
      "name": "debug-scan",
      "label": "Debug",
      "description": "Run the debug container with a scan mounted",
      "contexts": [
        "xnat:imageScanData"
      ],
      "external-inputs": [
        {
          "name": "scan",
          "description": "Input scan",
          "type": "Scan",
          "required": true,
          "provides-files-for-command-mount": "in",
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "scan",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    },
    {
      "name": "debug-assessor",
      "label": "Debug",
      "description": "Run the debug container with an assessor mounted",
      "contexts": [
        "xnat:imageAssessorData"
      ],
      "external-inputs": [
        {
          "name": "assessor",
          "description": "Input assessor",
          "type": "Assessor",
          "required": true,
          "provides-files-for-command-mount": "in",
          "load-children": false
        }
      ],
      "derived-inputs": [],
      "output-handlers": [
        {
          "name": "output-resource",
          "accepts-command-output": "output",
          "as-a-child-of": "assessor",
          "type": "Resource",
          "label": "DEBUG_OUTPUT2",
          "tags": []
        }
      ]
    }
  ],
  "container-labels": {},
  "generic-resources": {},
  "ulimits": {},
  "secrets": [],
  "visibility": "public"
}
and this is the workload screen 
immagine.png

Reply all
Reply to author
Forward
0 new messages