mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
resolves #33: laminar start output should reference run number
This commit is contained in:
parent
68d08f369b
commit
4d2388c271
@ -111,22 +111,25 @@ int main(int argc, char** argv) {
|
||||
fprintf(stderr, "Usage %s start <jobName>\n", argv[0]);
|
||||
return EINVAL;
|
||||
}
|
||||
kj::Vector<capnp::RemotePromise<LaminarCi::StartResults>> promises;
|
||||
struct: public kj::TaskSet::ErrorHandler {
|
||||
void taskFailed(kj::Exception&&) override {}
|
||||
} ignoreFailed;
|
||||
kj::TaskSet ts(ignoreFailed);
|
||||
int jobNameIndex = 2;
|
||||
// make a request for each job specified on the commandline
|
||||
do {
|
||||
auto req = laminar.startRequest();
|
||||
req.setJobName(argv[jobNameIndex]);
|
||||
int n = setParams(argc - jobNameIndex - 1, &argv[jobNameIndex + 1], req);
|
||||
promises.add(req.send());
|
||||
ts.add(req.send().then([&ret,argv,jobNameIndex](capnp::Response<LaminarCi::StartResults> resp){
|
||||
printf("%s:%d\n", argv[jobNameIndex], resp.getBuildNum());
|
||||
if(resp.getResult() != LaminarCi::JobResult::SUCCESS) {
|
||||
ret = EFAILED;
|
||||
}
|
||||
}));
|
||||
jobNameIndex += n + 1;
|
||||
} while(jobNameIndex < argc);
|
||||
// pend on the promises
|
||||
for(auto& p : promises) {
|
||||
if(p.wait(waitScope).getResult() != LaminarCi::JobResult::SUCCESS) {
|
||||
ret = EFAILED;
|
||||
}
|
||||
}
|
||||
ts.onEmpty().wait(waitScope);
|
||||
} else if(strcmp(argv[1], "set") == 0) {
|
||||
if(argc < 3) {
|
||||
fprintf(stderr, "Usage %s set param=value\n", argv[0]);
|
||||
|
@ -3,7 +3,7 @@
|
||||
interface LaminarCi {
|
||||
|
||||
trigger @0 (jobName :Text, params :List(JobParam)) -> (result :MethodResult);
|
||||
start @1 (jobName :Text, params :List(JobParam)) -> (result :JobResult);
|
||||
start @1 (jobName :Text, params :List(JobParam)) -> (result :JobResult, buildNum :UInt32);
|
||||
set @2 (jobName :Text, buildNum :UInt32, param :JobParam) -> (result :MethodResult);
|
||||
lock @3 (lockName :Text) -> ();
|
||||
release @4 (lockName :Text) -> ();
|
||||
|
@ -114,9 +114,11 @@ public:
|
||||
}
|
||||
std::shared_ptr<Run> run = laminar.queueJob(jobName, params);
|
||||
if(const Run* r = run.get()) {
|
||||
uint num = r->build;
|
||||
runWaiters[r].emplace_back(kj::newPromiseAndFulfiller<RunState>());
|
||||
return runWaiters[r].back().promise.then([context](RunState state) mutable {
|
||||
return runWaiters[r].back().promise.then([context,num](RunState state) mutable {
|
||||
context.getResults().setResult(fromRunState(state));
|
||||
context.getResults().setBuildNum(num);
|
||||
});
|
||||
} else {
|
||||
context.getResults().setResult(LaminarCi::JobResult::UNKNOWN);
|
||||
|
Loading…
Reference in New Issue
Block a user