코드 실행 (배치 모드)

Some sessions provide the batch mode, which offers an explicit build step required for multi-module programs or compiled programming languages. In this mode, you first upload files in prior to execution.

파일 업로드

  • URI: /session/:id/upload

  • Method: POST

매개변수들

Upload files to the session. You may upload multiple files at once using multi-part form-data encoding in the request body (RFC 1867/2388). The uploaded files are placed under /home/work directory (which is the home directory for all sessions by default), and existing files are always overwritten. If the filename has a directory part, non-existing directories will be auto-created. The path may be either absolute or relative, but only sub-directories under /home/work is allowed to be created.

힌트

This API is for uploading frequently-changing source files in prior to batch-mode execution. All files uploaded via this API is deleted when the session terminates. Use virtual folders to store and access larger, persistent, static data and library files for your codes.

경고

이 API를 사용해서 탑재된 가상 폴더에 직접적으로 파일을 업로드할 수 없습니다.그러나, 이 후 사용을 위해서 빌드 스크립트나 메인 프로그램 안의 가상폴더로 생성된 파일을 복사/이동할 수 있다.

이 API에는 몇 가지 제한이 있습니다.

각 파일의 최대 사이즈

1 MiB

업로드 요청당 파일 수

20

응답

HTTP Status Code

설명

204 OK

성공.

400 Bad Request

업로드된 파일 중 하나가 크기 제한을 초과하거나 파일이 너무 많을 때 반환됩니다.

빌드 단계를 사용하여 실행한다.

  • URI: /session/:id

  • Method: POST

매개변수들

매개변수

타입

설명

:id

slug

The session ID.

mode

enum[str]

상수 문자열 "batch".

code

str

반드시 빈 문자열 ``””``이어야 합니다.

runId

str

특정 실행을 위한 클라이언트측 고유 식별자 문자열 입니다. 해당 실행 개념에 대한 자세한 사항은 “ref”`code-execution-model`을 참조하십시오. 문자열이 주어지지 않는다면, API 서버가 첫 번째 응답에 임의로 하나를 할당할 것이고 클라이언트는 이후 같은 실행에서 이를 사용해야만 합니다.

options

object

Batch Execution Query Object.

예시:

{
  "mode": "batch",
  "options": "{batch-execution-query-object}",
  "runId": "af9185c5fb0eacb2"
}

응답

HTTP Status Code

설명

200 OK

The session has responded with the execution result. The response body contains a JSON object as described below.

필드

타입

result

object

Execution Result Object.

나열된 파일

Once files are uploaded to the session or generated during the execution of the code, there is a need to identify what files actually are in the current session. In this case, use this API to get the list of files of your compute sesison.

  • URI: /session/:id/files

  • 메소드 : GET

매개변수들

매개변수

타입

설명

:id

slug

The session ID.

path

str

세션 내부 경로 (default: \home\work).

응답

HTTP Status Code

설명

200 OK

성공.

404 Not Found

해당 경로가 존재하지 않습니다.

필드

타입

files

str

파일 목록을 포함하는 문자열화된 json

folder_path

str

세션 내부의 절대 경로

errors

str

지정된 경로를 스캔하는 동안 생성된 오류

다운로드한 파일

컴퓨팅 세션에서 파일을 다운로드 하십시오.

응답 내용은 tarfile binaries가 있는 멀티파트입니다. unpacking과 저장 같은 Post-processing은 클라이언트가 다뤄야만 합니다

  • URI: /session/:id/download

  • 메소드 : GET

매개변수들

매개변수

타입

설명

:id

slug

The session ID.

files

list[str]

File paths inside the session container to download. (maximum 5 files at once)

응답

HTTP Status Code

설명

200 OK

성공.