Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor : Use a sidecar for puppet things which cannot be unloaded #40

Closed
glennsarti opened this issue Jun 25, 2018 · 2 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@glennsarti
Copy link
Contributor

The language server is only able to load the default puppet modules that are outside of the thing being edited. This is due to Puppet not really being able to unload classes/types/facts etc. on the fly. So instead we need to call out to an external process to parse that information and then return it to the language server, thus the sidecar.

e.g.

To enumerate all of the Puppet custom types in a working directory;

  • Language server starts a sidecar process, instructing it to enumerate all classes/types/functions in the working directory; and return that in a structured data file (e.g. JSON)
  • Sidecar runs, and exports the relevant information to a file
  • Language server reads the file, and caches the information for use with autocomplete etc.

When the files are edited again, the process is repeated.


  • The sidecar would also be used for node graph generation, puppet strings

  • The sidecar would also be used to enumerate the default types/classes/functions and facts

  • The sidecar wouldn't be needed for linting as that doesn't require loading of puppet code (AFAIK)

  • The language server would need to throttle sidecar invocations otherwise max CPU and possibly memory could be reached pretty quickly.

@glennsarti glennsarti added this to the 0.14.0 milestone Jun 25, 2018
@glennsarti glennsarti added enhancement New feature or request Language Server labels Jun 25, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 11, 2018
Previously all of the Puppet helpers ran inside of a single instance of Puppet,
however this causes issues because classes and types cannot be unloaded in a
running instance. So instead, a sidecar executable is created which will run
out of process, in a fresh Puppet configuration, to enable enumerating types,
classes and functions etc.

This commit creates the basic skeleton of this sidecar process.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 11, 2018
This commit marks the puppet-language-sidecar ruby file as executable.  This is
mainly helpful for linux based developers.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 11, 2018
The Language Server and the sidecar need an agreed upon protocol to communicate
properly.  The agreed upon encoding will be UTF8 JSON strings.  This commit adds
the required classes which can be used to serialise and deserialise objects to
and from the sidecar process.  This commit also includes tests to validate the
serialisation process.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 11, 2018
…tions and types

This commit adds the ability for the sidecar process to enumerate classes,
functions and types, either in the default configuration (i.e. like a real
puppet agent) or only within the confines of a workspace directory (e.g. when
editing a module or control-repo). Currently this only supports querying a
puppet module workspace.

This commit also adds the ability to pass in puppet options (e.g. --vardir) into
the puppet configuration for the sidecar.

This commit also uses a filesystem based caching mechanism to speed up the
default enumerations.

The majority of this code was extracted from the existing PuppetHelper in the
Language Server and Puppet Monkey Patches.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 11, 2018
…unctions and types

This commit adds implementation and behavioural tests for the language sidecar
process enumerating classes, functions and types.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 12, 2018
…unctions and types

This commit adds implementation and behavioural tests for the language sidecar
process enumerating classes, functions and types.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
…tions and types

This commit adds the ability for the sidecar process to enumerate classes,
functions and types, either in the default configuration (i.e. like a real
puppet agent) or only within the confines of a workspace directory (e.g. when
editing a module or control-repo). Currently this only supports querying a
puppet module workspace.

This commit also adds the ability to pass in puppet options (e.g. --vardir) into
the puppet configuration for the sidecar.

This commit also uses a filesystem based caching mechanism to speed up the
default enumerations.

The majority of this code was extracted from the existing PuppetHelper in the
Language Server and Puppet Monkey Patches.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
…unctions and types

This commit adds implementation and behavioural tests for the language sidecar
process enumerating classes, functions and types.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
This commit adds the ability for the Sidecar to fetch the resources for a given
typename and title via the Action Parameters command line argument.  This is
similar to a `puppet resource` call.  This commit also adds the required
sidecar protocol additions and tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 13, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 14, 2018
This commit adds the ability for the Sidecar to fetch the resources for a given
typename and title via the Action Parameters command line argument.  This is
similar to a `puppet resource` call.  This commit also adds the required
sidecar protocol additions and tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 16, 2018
This commit adds the ability for the Sidecar to fetch the resources for a given
typename and title via the Action Parameters command line argument.  This is
similar to a `puppet resource` call.  This commit also adds the required
sidecar protocol additions and tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 16, 2018
This commit adds the ability for the sidecar to generate a node graph for a
manifest file on disk. The path the manifest is passed via the source Action
Parameter.  This commit also adds the required sidecar protocol additions and
tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 16, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 16, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 16, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 18, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 18, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 18, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 18, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 19, 2018
Previously all of the Puppet helpers ran inside of a single instance of Puppet,
however this causes issues because classes and types cannot be unloaded in a
running instance. So instead, a sidecar executable is created which will run
out of process, in a fresh Puppet configuration, to enable enumerating types,
classes and functions etc.

This commit creates the basic skeleton of this sidecar process.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jul 19, 2018
This commit marks the puppet-language-sidecar ruby file as executable.  This is
mainly helpful for linux based developers.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
…tions and types

This commit adds the ability for the sidecar process to enumerate classes,
functions and types, either in the default configuration (i.e. like a real
puppet agent) or only within the confines of a workspace directory (e.g. when
editing a module or control-repo). Currently this only supports querying a
puppet module workspace.

This commit also adds the ability to pass in puppet options (e.g. --vardir) into
the puppet configuration for the sidecar.

This commit also uses a filesystem based caching mechanism to speed up the
default enumerations.

The majority of this code was extracted from the existing PuppetHelper in the
Language Server and Puppet Monkey Patches.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
…unctions and types

This commit adds implementation and behavioural tests for the language sidecar
process enumerating classes, functions and types.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
This commit adds the ability for the Sidecar to fetch the resources for a given
typename and title via the Action Parameters command line argument.  This is
similar to a `puppet resource` call.  This commit also adds the required
sidecar protocol additions and tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
This commit adds the ability for the sidecar to generate a node graph for a
manifest file on disk. The path the manifest is passed via the source Action
Parameter.  This commit also adds the required sidecar protocol additions and
tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
Previously all of the Puppet helpers ran inside of a single instance of Puppet,
however this causes issues because classes and types cannot be unloaded in a
running instance. So instead, a sidecar executable is created which will run
out of process, in a fresh Puppet configuration, to enable enumerating types,
classes and functions etc.

This commit creates the basic skeleton of this sidecar process.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
This commit marks the puppet-language-sidecar ruby file as executable.  This is
mainly helpful for linux based developers.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
The Language Server and the sidecar need an agreed upon protocol to communicate
properly.  The agreed upon encoding will be UTF8 JSON strings.  This commit adds
the required classes which can be used to serialise and deserialise objects to
and from the sidecar process.  This commit also includes tests to validate the
serialisation process.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
…tions and types

This commit adds the ability for the sidecar process to enumerate classes,
functions and types, either in the default configuration (i.e. like a real
puppet agent) or only within the confines of a workspace directory (e.g. when
editing a module or control-repo). Currently this only supports querying a
puppet module workspace.

This commit also adds the ability to pass in puppet options (e.g. --vardir) into
the puppet configuration for the sidecar.

This commit also uses a filesystem based caching mechanism to speed up the
default enumerations.

The majority of this code was extracted from the existing PuppetHelper in the
Language Server and Puppet Monkey Patches.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
…unctions and types

This commit adds implementation and behavioural tests for the language sidecar
process enumerating classes, functions and types.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
This commit adds the ability for the Sidecar to fetch the resources for a given
typename and title via the Action Parameters command line argument.  This is
similar to a `puppet resource` call.  This commit also adds the required
sidecar protocol additions and tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
This commit adds the ability for the sidecar to generate a node graph for a
manifest file on disk. The path the manifest is passed via the source Action
Parameter.  This commit also adds the required sidecar protocol additions and
tests for the behaviour.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 3, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
jpogran pushed a commit that referenced this issue Oct 11, 2018
(GH-40) Create sidecar process to enumerate puppet types, classes, functions, node graph and puppet resource
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 12, 2018
Previously a sidecar process was introduced to query puppet for information,
however the Language Server was yet to take advantage of it.  This commit
modifies the Puppet Helper in the Language Server to use the sidecar instead.

This commit also uses a queueing mechanism to throttle the sidecar and ensure
that if there are duplicate sidecar requests, only the most recent is processed.
This ensures that that CPU and memory use is capped, but still maintains a good
repsonse time and user experience.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 12, 2018
Previously a sidecar process was introduced to query puppet for resource
information, however the Language Server was yet to take advantage of it.  This
commit modifies the Puppet Helper in the Language Server to use the sidecar
instead.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 12, 2018
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Oct 12, 2018
With the removal of the Puppet Helper calling puppet directly, but using the
sidecar, many of the test fixtures are no longer required.  This commit removes
the un-needed files.
jpogran pushed a commit that referenced this issue Oct 16, 2018
(GH-40) Use sidecar process to enumerate puppet types, classes, functions, node graph and puppet resource
@glennsarti
Copy link
Contributor Author

Initial sidecar is implemented giving feature parity to the non-sidecar version. Later issues will track adding new features.

@glennsarti
Copy link
Contributor Author

Closing as it's merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant