forked from TheSEED/app_service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
awe
37 lines (29 loc) · 968 Bytes
/
awe
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
35
36
37
use strict;
use Data::Dumper;
use DateTime;
use LWP::UserAgent;
use Bio::KBase::AuthToken;
use REST::Client;
use JSON::XS;
use MongoDB;
my $json = JSON::XS->new->pretty(1);
my $cli = MongoDB::MongoClient->new(host => 'localhost', port => 27017);
my $db = $cli->get_database('AWEDB');
my $col = $db->get_collection("Jobs");
my $token = Bio::KBase::AuthToken->new();
my $rest = REST::Client->new();
$rest->addHeader("Authorization", "OAuth " . $token->token);
my $url = "http://redwood:7080";
my $cur = $col->find({ '$and' => [ { "info.user" => "olson" }, { state => { '$ne' => "deleted" }} ] });
while (my $j = $cur->next)
{
my $info = $j->{info};
my $start = $info->{startedtime};
my $proj = $info->{project};
my $id = $j->{id};
my $user = $info->{user};
my $state = $j->{state};
next unless $user eq 'olson';
print join("\t", $id, $user, $proj, $state, $start, $info->{priority}), "\n";
# $rest->DELETE("$url/job/$id");
}