question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow Tracks to Declare Additional Dependencies

See original GitHub issue

If track code would require additional libraries to be installed, it would be good for them to be able to declare them. Because track code is maintained separately from Rally but not executed independently of it, Rally needs to be made aware of special dependencies the track may have.

Rally is more or less a “harness” for the execution of the track. A decent analogy would be the relationship between pytest and the unit tests it runs. It’s entirely possible to run a simple test invocation without further dependencies, but for more complex tests additional dependencies may be required. However, when you require more dependencies to be installed, both of the following workflows are undesirable:

  • a documented pip install step that should be taken manually prior to execution (requires both discovery and the knowledge of your workstation-local python ecosystem to manage, including things like upgrades, cleanup, and conflict resolution)
  • working through each ModuleNotFoundError as it comes by manually resolving it via pip

The above are rough enough given available tooling in a local environment but the task becomes more bloat-y in an automation environment, where extra dependencies are managed by extra steps, with packages and their versions defined outside of the project itself. Providing a dependency-resolution mechanism via Rally in the track definition is the way to avoid these complications.

I propose we extend the Track Registry concept to allow for additional dependencies, for example:

track.py

def register(registry):
  registry.register_dependency("numpy", "==1.21.4")

Which would be calling…

def register_dependency(library, version_string):

…and would invoke the runtime-local pip in-code, in the fashion mentioned in the pip docs (as a subprocess).

Potential goblins:

  1. I’m not sure whether we should try to perform an uninstall of any additional libraries after the race ends (or on any failure, or whatever)
  2. Registry invocations are re-run in every worker process, due to load_track being used as a way to ensure all Actors have the track code classloaded. We would likely only want to run pip on the first call per DriverActor, so some check for the library’s existence (and compliance with the version_string) is appropriate

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DJRickyBcommented, Mar 30, 2022

As we maintain multiple versions of tracks, each possibly needing its own specific package/version combinations, just documenting it is not sufficient. Installing packages to your local environment while developing the code is fine, but as soon as those tracks need to be executed:

  • In automated, ephemeral contexts
  • Across different stack versions (see Rally docs)

Just installing (and uninstalling, and upgrading, and downgrading) packages manually is unsustainable

0reactions
cavokzcommented, Mar 30, 2022

Is that the only option? Documenting the dependencies seems good enough for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Declaring dependencies
Gradle can model dependencies between modules. Those dependencies are called project dependencies because each module is represented by a Gradle project.
Read more >
Adding package dependencies to your app - Apple Developer
To add a package dependency to your Xcode project, select File > Swift Packages > Add ... It allows you to create a...
Read more >
Track custom operations with Application Insights .NET SDK
Application Insights SDKs automatically track incoming HTTP requests and calls to dependent services, such as HTTP requests and SQL queries.
Read more >
Allow adding additional dependencies to the installer #19
I've tried to create a workaround by adding a single REST endpoint to my WinForms app (by creating IWebHost in Program.cs). Sadly the...
Read more >
Managing dependencies
To track and manage the dependencies you add, you begin by putting your code in its own module. This creates a go.mod file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found