Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

lib.jsonnet 952 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  1. local yaml = importstr 'config.yaml';
  2. local config = std.parseYaml(yaml);
  3. local maybe(cond, obj) = if cond then obj else null;
  4. local cmd(cmd) = 'cargo run --release -- ' + cmd;
  5. local pipeline(stages, flag=true) = { stages: if flag then stages else {} };
  6. local normalizePath(path) =
  7. local parts = std.split(path, '/');
  8. local norm(ps, pfx) =
  9. if std.length(ps) == 0
  10. then pfx
  11. else if ps[0] == '.' || ps[0] == ''
  12. then norm(ps[1:], pfx)
  13. else if ps[0] == '..'
  14. then norm(ps[1:], pfx[0:std.length(pfx) - 1])
  15. else norm(ps[1:], pfx + [ps[0]]);
  16. std.join('/', norm(parts, []));
  17. // get the outputs of a stage.
  18. // dir: the directory of the file defining the stage
  19. // stage: the stage definition
  20. local stageOuts(dir, stage) =
  21. [
  22. normalizePath(std.join('/', [dir, std.get(stage, 'wdir', '.'), out]))
  23. for out in stage.outs
  24. ];
  25. {
  26. config: config,
  27. maybe: maybe,
  28. cmd: cmd,
  29. pipeline: pipeline,
  30. stageOuts: stageOuts,
  31. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...