Skip to content

Commit cfef81d

Browse files
committed
Make larger parts of the analysis work
1 parent 63ef9ba commit cfef81d

File tree

133 files changed

+13633
-3068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+13633
-3068
lines changed

.bazelignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
starlark

MODULE.bazel

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use_repo(
5858
"com_github_bluekeyes_go_gitdiff",
5959
"com_github_buildbarn_go_cdc",
6060
"com_github_google_uuid",
61+
"com_github_kballard_go_shellquote",
6162
"com_github_prometheus_client_golang",
6263
"com_github_secure_io_siv_go",
6364
"com_github_seehuhn_mt19937",
@@ -93,8 +94,10 @@ go_deps_dev.module_override(
9394
)
9495
go_deps_dev.module_override(
9596
patches = [
97+
"//:patches/net_starlark_go/thread.diff",
9698
"//:patches/net_starlark_go/dict-get-pop.diff",
9799
"//:patches/net_starlark_go/function-saving.diff",
100+
"//:patches/net_starlark_go/getattr-error-checking.diff",
98101
"//:patches/net_starlark_go/octal.diff",
99102
"//:patches/net_starlark_go/unwrap.diff",
100103
],

cmd/playground_storage_frontend/main.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func main() {
4949
return status.Error(codes.InvalidArgument, "No maximum unfinalized parents limit provided")
5050
}
5151
maximumUnfinalizedParentsLimit := object.NewLimit(configuration.MaximumUnfinalizedParentsLimit)
52-
objectStoreSemaphore := semaphore.NewWeighted(configuration.ObjectStoreConcurrency)
5352

5453
// Construct object and tag stores for mirrored replicas.
5554
objectStoreA, tagStoreA, err := createShardsForReplica(grpcClientFactory, configuration.GrpcClientsShardsReplicaA)
@@ -65,7 +64,7 @@ func main() {
6564
objectDownloader := object_mirrored.NewMirroredDownloader(objectStoreA, objectStoreB)
6665
objectUploader := object_leaserenewing.NewLeaseRenewingUploader(
6766
object_mirrored.NewMirroredUploader(objectStoreA, objectStoreB),
68-
objectStoreSemaphore,
67+
semaphore.NewWeighted(configuration.ObjectStoreConcurrency),
6968
maximumUnfinalizedParentsLimit,
7069
)
7170
dependenciesGroup.Go(func(ctx context.Context, siblingsGroup, dependenciesGroup program.Group) error {
@@ -101,7 +100,7 @@ func main() {
101100
s,
102101
dag.NewUploaderServer(
103102
objectUploader,
104-
objectStoreSemaphore,
103+
semaphore.NewWeighted(configuration.ObjectStoreConcurrency),
105104
tagUpdater,
106105
configuration.MaximumUnfinalizedDagsCount,
107106
maximumUnfinalizedParentsLimit,

deployments/demo/playground_scheduler.jsonnet

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local statePath = std.extVar('STATE_PATH');
1212
actionRouter: {
1313
simple: {
1414
initialSizeClassAnalyzer: {
15-
maximumExecutionTimeout: '7200s',
15+
maximumExecutionTimeout: '86400s',
1616
},
1717
},
1818
},

deployments/demo/playground_storage_frontend.jsonnet

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ local replicasCount = 4;
22
local statePath = std.extVar('STATE_PATH');
33

44
{
5+
global: { diagnosticsHttpServer: {
6+
httpServers: [{
7+
listenAddresses: [':9981'],
8+
authenticationPolicy: { allow: {} },
9+
}],
10+
enablePrometheus: true,
11+
enablePprof: true,
12+
} },
513
grpcServers: [{
614
listenPaths: [statePath + '/playground_storage_frontend.sock'],
715
authenticationPolicy: { allow: {} },

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ require (
1414
github.com/buildbarn/bb-storage v0.0.0-20241220082316-ff8c80c6eb4c
1515
github.com/buildbarn/go-cdc v0.0.0-20240326143813-ab4a540e41c6
1616
github.com/google/uuid v1.6.0
17+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1718
github.com/prometheus/client_golang v1.20.5
1819
github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4
1920
github.com/seehuhn/mt19937 v1.0.0
2021
github.com/stretchr/testify v1.10.0
2122
github.com/ulikunitz/xz v0.5.12
22-
go.starlark.net v0.0.0-20241226192728-8dfa5b98479f
23+
go.starlark.net v0.0.0-20250205221240-492d3672b3f4
2324
go.uber.org/mock v0.5.0
2425
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8
2526
golang.org/x/sync v0.10.0

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
165165
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
166166
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
167167
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
168+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
169+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
168170
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
169171
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
170172
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
@@ -252,8 +254,8 @@ go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qq
252254
go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck=
253255
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
254256
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
255-
go.starlark.net v0.0.0-20241226192728-8dfa5b98479f h1:Zs/py28HDFATSDzPcfIzrBFjVsV7HzDEGNNVZIGsjm0=
256-
go.starlark.net v0.0.0-20241226192728-8dfa5b98479f/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8=
257+
go.starlark.net v0.0.0-20250205221240-492d3672b3f4 h1:eBP+boBfJoGU3irqbxGTcTlKcbNwJCOdbmsnDq56nak=
258+
go.starlark.net v0.0.0-20250205221240-492d3672b3f4/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8=
257259
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
258260
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
259261
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
diff --git starlark/library.go starlark/library.go
2-
index 4e73a40..988ece2 100644
2+
index f03d552..eaf7159 100644
33
--- starlark/library.go
44
+++ starlark/library.go
5-
@@ -1203,7 +1203,11 @@ func zip(thread *Thread, _ *Builtin, args Tuple, kwargs []Tuple) (Value, error)
5+
@@ -1205,7 +1205,11 @@ func zip(thread *Thread, _ *Builtin, args Tuple, kwargs []Tuple) (Value, error)
66
// https://github.com/google/starlark-go/blob/master/doc/spec.md#dict·get
7-
func dict_get(_ *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
7+
func dict_get(thread *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
88
var key, dflt Value
99
- if err := UnpackPositionalArgs(b.Name(), args, kwargs, 1, &key, &dflt); err != nil {
1010
+ if err := UnpackArgs(
@@ -14,10 +14,10 @@ index 4e73a40..988ece2 100644
1414
+ ); err != nil {
1515
return nil, err
1616
}
17-
if v, ok, err := b.Receiver().(*Dict).Get(key); err != nil {
18-
@@ -1248,7 +1252,11 @@ func dict_keys(_ *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error)
17+
if v, ok, err := b.Receiver().(*Dict).Get(thread, key); err != nil {
18+
@@ -1250,7 +1254,11 @@ func dict_keys(_ *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error)
1919
// https://github.com/google/starlark-go/blob/master/doc/spec.md#dict·pop
20-
func dict_pop(_ *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
20+
func dict_pop(thread *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
2121
var k, d Value
2222
- if err := UnpackPositionalArgs(b.Name(), args, kwargs, 1, &k, &d); err != nil {
2323
+ if err := UnpackArgs(
@@ -27,4 +27,4 @@ index 4e73a40..988ece2 100644
2727
+ ); err != nil {
2828
return nil, err
2929
}
30-
if v, found, err := b.Receiver().(*Dict).Delete(k); err != nil {
30+
if v, found, err := b.Receiver().(*Dict).Delete(thread, k); err != nil {

patches/net_starlark_go/function-saving.diff

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git internal/compile/compile.go internal/compile/compile.go
2-
index b257d70..c171dc6 100644
2+
index bc38200..fe7e58e 100644
33
--- internal/compile/compile.go
44
+++ internal/compile/compile.go
55
@@ -29,6 +29,7 @@ import (
@@ -18,31 +18,31 @@ index b257d70..c171dc6 100644
1818

1919
// -- transient state --
2020

21-
@@ -364,7 +366,6 @@ type pcomp struct {
21+
@@ -366,7 +368,6 @@ type pcomp struct {
2222

2323
names map[string]uint32
2424
constants map[interface{}]uint32
2525
- functions map[*Funcode]uint32
2626
}
2727

2828
// An fcomp holds the compiler state for a Funcode.
29-
@@ -503,7 +504,6 @@ func File(opts *syntax.FileOptions, stmts []syntax.Stmt, pos syntax.Position, na
29+
@@ -523,7 +524,6 @@ func File(opts *syntax.FileOptions, stmts []syntax.Stmt, pos syntax.Position, na
3030
},
3131
names: make(map[string]uint32),
3232
constants: make(map[interface{}]uint32),
3333
- functions: make(map[*Funcode]uint32),
3434
}
3535
pcomp.prog.Toplevel = pcomp.function(name, pos, stmts, locals, nil)
3636

37-
@@ -521,6 +521,7 @@ func (pcomp *pcomp) function(name string, pos syntax.Position, stmts []syntax.St
37+
@@ -541,6 +541,7 @@ func (pcomp *pcomp) function(name string, pos syntax.Position, stmts []syntax.St
3838
Doc: docStringFromBody(stmts),
3939
Locals: bindings(locals),
4040
FreeVars: bindings(freevars),
4141
+ Index: math.MaxUint32,
4242
},
4343
}
4444

45-
@@ -980,13 +981,11 @@ func (pcomp *pcomp) constantIndex(v interface{}) uint32 {
45+
@@ -1001,13 +1002,11 @@ func (pcomp *pcomp) constantIndex(v interface{}) uint32 {
4646
// functionIndex returns the index of the specified function
4747
// AST the nestedfun pool, adding it if necessary.
4848
func (pcomp *pcomp) functionIndex(fn *Funcode) uint32 {
@@ -60,7 +60,7 @@ index b257d70..c171dc6 100644
6060

6161
// string emits code to push the specified string.
6262
diff --git internal/compile/serial.go internal/compile/serial.go
63-
index 0dbae47..af003d7 100644
63+
index 6131322..0b27769 100644
6464
--- internal/compile/serial.go
6565
+++ internal/compile/serial.go
6666
@@ -267,10 +267,10 @@ func DecodeProgram(data []byte) (_ *Program, err error) {
@@ -85,15 +85,16 @@ index 0dbae47..af003d7 100644
8585
id := d.binding()
8686
doc := d.string()
8787
code := d.bytes()
88-
@@ -395,5 +395,6 @@ func (d *decoder) function() *Funcode {
88+
@@ -395,6 +395,7 @@ func (d *decoder) function() *Funcode {
8989
NumKwonlyParams: numKwonlyParams,
9090
HasVarargs: hasVarargs,
9191
HasKwargs: hasKwargs,
9292
+ Index: index,
9393
}
94-
}
94+
fn.finish()
95+
return fn
9596
diff --git starlark/eval.go starlark/eval.go
96-
index be3eb61..fe2b3bc 100644
97+
index a4640e4..16b75bb 100644
9798
--- starlark/eval.go
9899
+++ starlark/eval.go
99100
@@ -5,6 +5,7 @@
@@ -174,10 +175,10 @@ index be3eb61..fe2b3bc 100644
174175
// and global environment. This is a variant of ExecFile specialized to
175176
// the needs of a REPL, in which a sequence of input chunks, each
176177
diff --git starlark/value.go starlark/value.go
177-
index 5e323ca..345b664 100644
178+
index d89a9f5..62d679f 100644
178179
--- starlark/value.go
179180
+++ starlark/value.go
180-
@@ -696,6 +696,25 @@ type Function struct {
181+
@@ -701,6 +701,25 @@ type Function struct {
181182
freevars Tuple
182183
}
183184

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git starlark/library.go starlark/library.go
2+
index f03d552..3e057e5 100644
3+
--- starlark/library.go
4+
+++ starlark/library.go
5+
@@ -463,7 +463,8 @@ func getattr(thread *Thread, b *Builtin, args Tuple, kwargs []Tuple) (Value, err
6+
if err != nil {
7+
// An error could mean the field doesn't exist,
8+
// or it exists but could not be computed.
9+
- if dflt != nil {
10+
+ var errNoSuchAttr NoSuchAttrError
11+
+ if errors.As(err, &errNoSuchAttr) && dflt != nil {
12+
return dflt, nil
13+
}
14+
return nil, nameErr(b, err)
15+
@@ -491,6 +492,10 @@ func hasattr(thread *Thread, _ *Builtin, args Tuple, kwargs []Tuple) (Value, err
16+
if err == nil {
17+
return Bool(v != nil), nil
18+
}
19+
+ var errNoSuchAttr NoSuchAttrError
20+
+ if !errors.As(err, &errNoSuchAttr) {
21+
+ return nil, err
22+
+ }
23+
24+
// An error does not conclusively indicate presence or
25+
// absence of a field: it could occur while computing

0 commit comments

Comments
 (0)