github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/plugins/shared/cmd/launcher/README.md (about)

     1  This command allows plugin developers to interact with a plugin directly. The
     2  command has subcommands for each plugin type. See the subcommand help text for
     3  detailed usage information.
     4  
     5  # Device Example
     6  
     7  The `device` subcommand provides a way to interact and visualize the data being
     8  returned by a device plugin. As an example we will run the example device
     9  plugin. To use this command with your own device plugin substitute the example
    10  plugin with your own.
    11  
    12  
    13  ```
    14  # Current working directory should be the root folder: github.com/hashicorp/nomad
    15  
    16  # Build the plugin launcher
    17  $ go build github.com/hashicorp/nomad/plugins/shared/cmd/launcher/
    18  
    19  # Build the example fs-device plugin
    20  $ go build -o fs-device github.com/hashicorp/nomad/plugins/device/cmd/example/cmd
    21  
    22  # Launch the plugin
    23  $ ./launcher device ./fs-device
    24  > Availabile commands are: exit(), fingerprint(), stop_fingerprint(), stats(), stop_stats(), reserve(id1, id2, ...)
    25  >  2018-08-28T14:54:45.658-0700 [INFO ] nomad-plugin-launcher.fs-device: config set: @module=example-fs-device config="example.Config{Dir:".", ListPeriod:"5s", StatsPeriod:"5s", UnhealthyPerm:"-rwxrwxrwx"}" timestamp=2018-08-28T14:54:45.658-0700
    26  
    27  ^C
    28  2018-08-28T14:54:54.727-0700 [ERROR] nomad-plugin-launcher: error interacting with plugin: error=interrupted
    29  
    30  # Lets launch changing the configuration
    31  $ cat <<\EOF >fs-device.config
    32  > config {
    33  >   dir = "./plugins"
    34  >   stats_period = "2s"
    35  > }
    36  > EOF
    37  
    38  $ ./launcher device ./fs-device ./fs-device.config
    39  2018-08-28T14:59:45.886-0700 [INFO ] nomad-plugin-launcher.fs-device: config set: @module=example-fs-device config="example.Config{Dir:"./plugins", ListPeriod:"5s", StatsPeriod:"2s", UnhealthyPerm:"-rwxrwxrwx"}" timestamp=2018-08-28T14:59:45.886-0700
    40  > Availabile commands are: exit(), fingerprint(), stop_fingerprint(), stats(), stop_stats(), reserve(id1, id2, ...)
    41  >  fingerprint()
    42  >  > fingerprint: &device.FingerprintResponse{
    43      Devices: {
    44          &device.DeviceGroup{
    45              Vendor:  "nomad",
    46              Type:    "file",
    47              Name:    "mock",
    48              Devices: {
    49                  &device.Device{
    50                      ID:         "serve.go",
    51                      Healthy:    true,
    52                      HealthDesc: "",
    53                      HwLocality: (*device.DeviceLocality)(nil),
    54                  },
    55              },
    56              Attributes: {},
    57          },
    58      },
    59      Error: nil,
    60  }
    61  ^C
    62  2018-08-28T15:00:00.329-0700 [ERROR] nomad-plugin-launcher: error interacting with plugin: error=interrupted
    63  ```