Skip to content

Commit

Permalink
Added proto files for upcoming debug messages (subject to change).
Browse files Browse the repository at this point in the history
To compile, run:
$ protoc --proto_path=. --python_out=. *.proto
  • Loading branch information
klueska committed Oct 25, 2016
1 parent e806225 commit 32ab1a8
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 0 deletions.
86 changes: 86 additions & 0 deletions agent.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import "mesos.proto";

package mesos.agent;

option java_package = "org.apache.mesos.agent";
option java_outer_classname = "Protos";


message Call {
enum Type {
UNKNOWN = 0;

// Launches a nested container whose life-cycle is tied to the
// lifetime of the connection used to make this call. Once the
// agent receives the request, it will hold onto it until the
// container runs to completion or there is an error. Upon
// success, a 200 response will be initiated with an “infinite”
// chunked response (but no data will ever be sent over this
// connection). On error, an appropriate 400 error will be
// returned. If the connection is ever broken by the client, the
// container will be destroyed.
LAUNCH_NESTED_CONTAINER_SESSION = 17;

// Attaches a remote client to the the input/output of the
// entrypoint of a container. All input/output data is packed into
// I/O messages and interleaved with control messages sent between
// a client and the agent. A single chunked request is used to
// stream messages to the agent over the input stream, and a
// single chunked response is used to stream messages to the
// client over the output stream.
ATTACH_CONTAINER_OUTPUT = 18;
ATTACH_CONTAINER_INPUT = 19;
}


message LaunchNestedContainerSession {
required ContainerID container_id = 1;
optional CommandInfo command = 2;

// NOTE: The following should be backported
// into the TaskInfo message post-mvp
optional TtyInfo tty_info = 3;
optional bool interactive = 4;

// NOTE: The following field will be added post-mvp to
// support mounting a new image in the nested container.
// optional ContainerInfo container = 5;
}

message AttachContainerOutput {
required ContainerID container_id = 1;
}

message AttachContainerInput {
enum Type {
UNKNOWN = 0;

CONTAINER_ID = 1;
PROCESS_IO = 2;
}

optional Type type = 1;
optional ContainerID container_id = 2;
optional ProcessIO process_io = 3;
}

optional LaunchNestedContainerSession launch_nested_container_session = 9;
optional AttachContainerOutput attach_container_output = 10;
optional AttachContainerInput attach_container_input = 11;
}
164 changes: 164 additions & 0 deletions mesos.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mesos;

option java_package = "org.apache.mesos";
option java_outer_classname = "Protos";


message TtyInfo {
message WindowSize {
required uint32 rows = 1;
required uint32 columns = 2;
}

optional WindowSize window_size = 1;
}


message ProcessIO {
enum Type {
UNKNOWN = 0;

DATA = 1;
CONTROL = 2;
}

message Data {
enum Type {
UNKNOWN = 0;

STDIN = 1;
STDOUT = 2;
STDERR = 3;
}

optional Type type = 1;
optional bytes data = 2;
}

message Control {
enum Type {
UNKNOWN = 0;

TTY_INFO = 1;
}

optional Type type = 1;
optional TtyInfo tty_info = 2;
}

optional Type type = 1;
optional Data data = 2;
optional Control control = 3;
}


/**
* ID used to uniquely identify a container. If the `parent` is not
* specified, the ID is a UUID generated by the agent to uniquely
* identify the container of an executor run. If the `parent` field is
* specified, it represents a nested container.
*/
message ContainerID {
required string value = 1;
optional ContainerID parent = 2;
}


/**
* Describes a command, executed via: '/bin/sh -c value'. Any URIs specified
* are fetched before executing the command. If the executable field for an
* uri is set, executable file permission is set on the downloaded file.
* Otherwise, if the downloaded file has a recognized archive extension
* (currently [compressed] tar and zip) it is extracted into the executor's
* working directory. This extraction can be disabled by setting `extract` to
* false. In addition, any environment variables are set before executing
* the command (so they can be used to "parameterize" your command).
*/
message CommandInfo {
message URI {
required string value = 1;
optional bool executable = 2;

// In case the fetched file is recognized as an archive, extract
// its contents into the sandbox. Note that a cached archive is
// not copied from the cache to the sandbox in case extraction
// originates from an archive in the cache.
optional bool extract = 3 [default = true];

// If this field is "true", the fetcher cache will be used. If not,
// fetching bypasses the cache and downloads directly into the
// sandbox directory, no matter whether a suitable cache file is
// available or not. The former directs the fetcher to download to
// the file cache, then copy from there to the sandbox. Subsequent
// fetch attempts with the same URI will omit downloading and copy
// from the cache as long as the file is resident there. Cache files
// may get evicted at any time, which then leads to renewed
// downloading. See also "docs/fetcher.md" and
// "docs/fetcher-cache-internals.md".
optional bool cache = 4;

// The fetcher's default behavior is to use the URI string's basename to
// name the local copy. If this field is provided, the local copy will be
// named with its value instead. If there is a directory component (which
// must be a relative path), the local copy will be stored in that
// subdirectory inside the sandbox.
optional string output_file = 5;
}

repeated URI uris = 1;

optional Environment environment = 2;

// There are two ways to specify the command:
// 1) If 'shell == true', the command will be launched via shell
// (i.e., /bin/sh -c 'value'). The 'value' specified will be
// treated as the shell command. The 'arguments' will be ignored.
// 2) If 'shell == false', the command will be launched by passing
// arguments to an executable. The 'value' specified will be
// treated as the filename of the executable. The 'arguments'
// will be treated as the arguments to the executable. This is
// similar to how POSIX exec families launch processes (i.e.,
// execlp(value, arguments(0), arguments(1), ...)).
// NOTE: The field 'value' is changed from 'required' to 'optional'
// in 0.20.0. It will only cause issues if a new framework is
// connecting to an old master.
optional bool shell = 6 [default = true];
optional string value = 3;
repeated string arguments = 7;

// Enables executor and tasks to run as a specific user. If the user
// field is present both in FrameworkInfo and here, the CommandInfo
// user value takes precedence.
optional string user = 5;
}


/**
* Describes a collection of environment variables. This is used with
* CommandInfo in order to set environment variables before running a
* command.
*/
message Environment {
message Variable {
required string name = 1;
required string value = 2;
}

repeated Variable variables = 1;
}

0 comments on commit 32ab1a8

Please sign in to comment.