use of build.buildfarm.instance.stub.StubInstance in project bazel-buildfarm by bazelbuild.
the class IndexWorker method main.
public static void main(String[] args) throws Exception {
String host = args[0];
String instanceName = args[1];
DigestUtil digestUtil = DigestUtil.forHash(args[2]);
String reindexworker = args[3];
ManagedChannel channel = createChannel(host);
Instance instance = new StubInstance(instanceName, digestUtil, channel);
CasIndexResults results = instance.reindexCas(reindexworker);
System.out.println(results.toMessage());
instance.stop();
}
use of build.buildfarm.instance.stub.StubInstance in project bazel-buildfarm by bazelbuild.
the class Mount method main.
@SuppressWarnings("BusyWait")
public static void main(String[] args) throws Exception {
String host = args[0];
String instanceName = args[1];
DigestUtil digestUtil = DigestUtil.forHash(args[2]);
ManagedChannel channel = createChannel(host);
Instance instance = new StubInstance(instanceName, digestUtil, channel);
Path cwd = Paths.get(".");
FuseCAS fuse = new FuseCAS(cwd.resolve(args[3]), new InputStreamFactory() {
final Map<Digest, ByteString> cache = new HashMap<>();
public synchronized InputStream newInput(Digest blobDigest, long offset) {
if (cache.containsKey(blobDigest)) {
return cache.get(blobDigest).substring((int) offset).newInput();
}
try {
ByteString value = getBlob(instance, blobDigest, RequestMetadata.getDefaultInstance());
if (offset == 0) {
cache.put(blobDigest, value);
}
return value.newInput();
} catch (IOException e) {
return null;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
});
// FIXME make bettar
fuse.createInputRoot(args[5], DigestUtil.parseDigest(args[4]));
try {
// noinspection InfiniteLoopStatement
for (; ; ) {
Thread.sleep(1000);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
fuse.stop();
}
}
use of build.buildfarm.instance.stub.StubInstance in project bazel-buildfarm by bazelbuild.
the class Cat method cancellableMain.
private static void cancellableMain(String host, String instanceName, DigestUtil digestUtil, String type, Iterable<String> args) throws Exception {
ManagedChannel channel = createChannel(host);
Instance instance = new StubInstance(instanceName, "bf-cat", digestUtil, channel, Durations.fromSeconds(10));
// should do something to match caps against requested digests
try {
for (CatCommand command : commands) {
if (command.name().equals(type)) {
command.run(instance, args);
return;
}
}
System.err.printf("Unrecognized bf-cat type %s%n", type);
usage();
} finally {
instance.stop();
}
}
use of build.buildfarm.instance.stub.StubInstance in project bazel-buildfarm by bazelbuild.
the class Ac method main.
public static void main(String[] args) throws Exception {
// get arguments for establishing an instance
String host = args[0];
String instanceName = args[1];
DigestUtil digestUtil = DigestUtil.forHash(args[2]);
// create instance
ManagedChannel channel = createChannel(host);
Instance instance = new StubInstance(instanceName, digestUtil, channel);
// upload fake data to the Action Cache.
DigestUtil hash = new DigestUtil(HashFunction.SHA256);
DigestUtil.ActionKey key = DigestUtil.asActionKey(hash.compute(ByteString.copyFromUtf8("Hello, World")));
ActionResult.Builder result = ActionResult.newBuilder();
instance.putActionResult(key, result.build());
instance.stop();
}
use of build.buildfarm.instance.stub.StubInstance in project bazel-buildfarm by bazelbuild.
the class Cancel method main.
public static void main(String[] args) throws Exception {
String host = args[0];
String instanceName = args[1];
DigestUtil digestUtil = DigestUtil.forHash(args[2]);
ManagedChannel channel = createChannel(host);
Instance instance = new StubInstance(instanceName, digestUtil, channel);
for (int i = 3; i < args.length; i++) {
instance.cancelOperation(args[i]);
}
instance.stop();
}
Aggregations