mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Work on jobTag Script
This commit is contained in:
parent
95f616f45e
commit
e27a3fda79
48
jobTag.pl
Normal file → Executable file
48
jobTag.pl
Normal file → Executable file
@ -41,28 +41,48 @@ my $dbh = DBI->connect(
|
|||||||
"DBI:SQLite:dbname=$database", "", "", \%attr)
|
"DBI:SQLite:dbname=$database", "", "", \%attr)
|
||||||
or die "Could not connect to database: $DBI::errstr";
|
or die "Could not connect to database: $DBI::errstr";
|
||||||
|
|
||||||
my $sth_select_job = $dbh->prepare(qq{
|
my $sth_query_job = $dbh->prepare(qq{
|
||||||
SELECT id, user_id, job_id, cluster_id,
|
SELECT j.*
|
||||||
start_time, stop_time, duration, num_nodes,
|
FROM jobtag jt, job j, tag t
|
||||||
has_profile
|
WHERE jt.tag_id=t.tag_id
|
||||||
FROM job
|
AND t.name=?
|
||||||
WHERE job_id=?
|
AND j.id=jt.job_id
|
||||||
|
GROUP BY j.id
|
||||||
});
|
});
|
||||||
|
|
||||||
my $sth_update_job = $dbh->prepare(qq{
|
my $sth_select_job = $dbh->prepare(qq{
|
||||||
UPDATE job
|
SELECT id
|
||||||
SET has_profile = ?,
|
FROM job
|
||||||
mem_used_max = ?,
|
WHERE job_id=?
|
||||||
flops_any_avg = ?,
|
|
||||||
mem_bw_avg = ?
|
|
||||||
WHERE id=?;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
my $sth_select_tag = $dbh->prepare(qq{
|
my $sth_select_tag = $dbh->prepare(qq{
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM tag
|
FROM tag
|
||||||
WHERE tag_name=?
|
WHERE name=?
|
||||||
|
});
|
||||||
|
|
||||||
|
my $sth_insert_tag = $dbh->prepare(qq{
|
||||||
|
INSERT INTO tag(type,name)
|
||||||
|
VALUES(?,?)
|
||||||
|
});
|
||||||
|
|
||||||
|
my $sth_job_add_tag = $dbh->prepare(qq{
|
||||||
|
INSERT INTO jobtag(job_id,tag_id)
|
||||||
|
VALUES(?,?)
|
||||||
});
|
});
|
||||||
|
|
||||||
my $CMD = $ARGV[0];
|
my $CMD = $ARGV[0];
|
||||||
|
|
||||||
|
if ( $CMD eq 'ADD' ) {
|
||||||
|
# body...
|
||||||
|
}
|
||||||
|
elsif ( $CMD eq 'RM' ) {
|
||||||
|
# elsif...
|
||||||
|
}
|
||||||
|
elsif ( $CMD eq 'LS' ) {
|
||||||
|
# elsif...
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# else...
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user