ocaml / ocaml/dune

Resources for Actions

Open
#7,149 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted proposal
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

This ticket originates from a discussion I've had with Andrey.

Problem

Some actions are quite expensive to execute and there's no way to express an estimate of the amount of resources they'll be using. For example, a test action can spin up a full database, a web server, and some integration tests as part of a single test. If a test action is this expensive, we need a way to tell dune not to run so many such expensive actions concurrently.

Solution(s)

  1. We already have a (locks <path>) field for making actions mutually exclusive. We could easily upgrade this mechanism to a token with a finite number of available of resources. For example:
(resource
 (name foobar)
 (availability 10))

(rule
  (action 
   (with-resource foobar 2 (run ./foo.exe))) ;; this will consume 2 out of foobar. if 2 aren't available, it will wait until it is.
 ...)
  1. We already have an existing "resource" - jobs. We could make this resource available more explicitly: (with-resource dune-jobs 3 ..) to ask for 3 slots out of -j rather than just one.

cc @snowleopard

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reviewing the existing (locks <path>) mechanism and -j job handling; done would require choosing and specifying a resource model and its behavior before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.