Skip to content
Snippets Groups Projects
Commit be7d6a28 authored by Chris Hines's avatar Chris Hines
Browse files

You can now search for a history of jobs and view their usage information

parent aa83589b
No related branches found
No related tags found
2 merge requests!21New css dev,!17Dev
Pipeline #7756 passed
...@@ -4,6 +4,7 @@ import {Strudelapp, StrudelappInstance } from './strudelapp'; ...@@ -4,6 +4,7 @@ import {Strudelapp, StrudelappInstance } from './strudelapp';
export class Job { export class Job {
public name: string; public name: string;
public appname: string;
public jobid: string; public jobid: string;
public desc: string; public desc: string;
public state: string; public state: string;
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list-item> </mat-list-item>
<div *ngFor="let job of ((identitySubject | async).joblist | async) ; let lastItem = last"> <div *ngFor="let job of ((identitySubject | async).joblist | async) ; let lastItem = last">
<div *ngIf="(appSubject | async).name == job.name && job.state != 'Finished'"> <div *ngIf="(appSubject | async).name == job.appname && job.state != 'Finished'">
<app-job [jobdata]=job></app-job> <app-job [jobdata]=job></app-job>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</div> </div>
</div> </div>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div *ngFor="let job of ((identitySubject | async).joblist | async) ; let lastItem = last"> <div *ngFor="let job of ((identitySubject | async).joblist | async) ; let lastItem = last">
<div *ngIf="(appSubject | async).name == job.name && job.state == 'Finished'"> <div *ngIf="(appSubject | async).name == job.app.name && job.state == 'Finished'">
<app-job [jobdata]=job></app-job> <app-job [jobdata]=job></app-job>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</div> </div>
......
...@@ -6,7 +6,7 @@ export class AppAction { ...@@ -6,7 +6,7 @@ export class AppAction {
} }
export class Strudelapp { export class Strudelapp {
url: string; // A url used to retrieve extra config options. May be null url: string; // A url used to retrieve extra config options. May be null
name: string; // Human readable name name: string;
startscript: string; // batch script ... should NOT include resource directives startscript: string; // batch script ... should NOT include resource directives
// resource directives like #SBATCH belong in the batchinterface // resource directives like #SBATCH belong in the batchinterface
actions: AppAction[]; actions: AppAction[];
......
...@@ -17,9 +17,12 @@ export class StrudelappsService { ...@@ -17,9 +17,12 @@ export class StrudelappsService {
app = applist[0]; app = applist[0];
for ( let item of applist) { for ( let item of applist) {
sapp = <Strudelapp>item; sapp = <Strudelapp>item;
idx = sapp.name.toLowerCase().indexOf(name.toLowerCase()) let sname = sapp.name.toLowerCase().replace(/\s/g, '');
let jname = name.toLowerCase().replace(/\s/g, '');
idx = sname.indexOf(jname)
if (idx == 0) { if (idx == 0) {
app = item; app = item;
console.log('matched',jname);
return app; return app;
} }
if (sapp.applist != null) { if (sapp.applist != null) {
...@@ -29,6 +32,7 @@ export class StrudelappsService { ...@@ -29,6 +32,7 @@ export class StrudelappsService {
} }
} }
} }
console.log('didnt find app',name);
return null; return null;
} }
......
...@@ -144,8 +144,8 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { ...@@ -144,8 +144,8 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
} }
for (j of joblist) { for (j of joblist) {
if (j.app === undefined) { if (j.app === undefined || j.app == null) {
j.app = this.strudelappsService.getApp(j.name,identity.site.appCatalog.value); j.app = this.strudelappsService.getApp(j.appname,identity.site.appCatalog.value);
} }
if (j.identity == undefined) { if (j.identity == undefined) {
j.identity = identity; j.identity = identity;
...@@ -175,7 +175,6 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { ...@@ -175,7 +175,6 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
} }
private getUserHealthError(error: any, identity: Identity) { private getUserHealthError(error: any, identity: Identity) {
console.log('user health error');
identity.accountalerts.next([]); identity.accountalerts.next([]);
this.statusMsg.next("There was an error checking your user account"); this.statusMsg.next("There was an error checking your user account");
//return this.getJobsError(error,identity) //return this.getJobsError(error,identity)
...@@ -286,7 +285,6 @@ addUserHealth(identity,resp) { ...@@ -286,7 +285,6 @@ addUserHealth(identity,resp) {
if (ci == null) { if (ci == null) {
ci = [] ci = []
} }
console.log('in add User HEalth');
for (let i of resp) { for (let i of resp) {
let h = new Health(); let h = new Health();
h.stat = i.stat; h.stat = i.stat;
...@@ -301,7 +299,6 @@ addUserHealth(identity,resp) { ...@@ -301,7 +299,6 @@ addUserHealth(identity,resp) {
ci.push(h); ci.push(h);
} }
identity.accountalerts.next(ci); identity.accountalerts.next(ci);
console.log('id health is',identity.accountalerts.value);
} }
...@@ -358,7 +355,6 @@ addUserHealth(identity,resp) { ...@@ -358,7 +355,6 @@ addUserHealth(identity,resp) {
} }
submitted(resp: any, identity: Identity ) { submitted(resp: any, identity: Identity ) {
console.log('submitted',resp);
this.getJobs(identity); this.getJobs(identity);
} }
...@@ -393,7 +389,6 @@ addUserHealth(identity,resp) { ...@@ -393,7 +389,6 @@ addUserHealth(identity,resp) {
params.set('cmd',JSON.stringify(action.paramscmd)); params.set('cmd',JSON.stringify(action.paramscmd));
let paramstr = params.toString(); let paramstr = params.toString();
job.connectionState = 1; job.connectionState = 1;
console.log('in getAppInstance');
this.http.get<string>(this.Base+'/appinstance/'+username+'/'+loginhost+'/'+batchhost+'/'+jobid+'?'+paramstr, options) this.http.get<string>(this.Base+'/appinstance/'+username+'/'+loginhost+'/'+batchhost+'/'+jobid+'?'+paramstr, options)
// .pipe(catchError(this.handleError)) // .pipe(catchError(this.handleError))
.subscribe(resp => { job.appinst = resp; if (action.client != null) { this.createTunnel(job, action) } else { job.connectionState = 0} }, .subscribe(resp => { job.appinst = resp; if (action.client != null) { this.createTunnel(job, action) } else { job.connectionState = 0} },
...@@ -528,7 +523,6 @@ private httperror(errorstr: string) { ...@@ -528,7 +523,6 @@ private httperror(errorstr: string) {
private handleAppInstanceError(job: Job, error: any) { private handleAppInstanceError(job: Job, error: any) {
console.log('in handle app instance error');
console.log(error); console.log(error);
job.connectionState=0; job.connectionState=0;
if (error.error !== undefined && error.error.message !== undefined) { if (error.error !== undefined && error.error.message !== undefined) {
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
"client": {"cmd": null, "redir": "index.html?token={token}" }, "client": {"cmd": null, "redir": "index.html?token={token}" },
"states": ["RUNNING","Finished"] "states": ["RUNNING","Finished"]
}, },
{
"name": "View Usage",
"paramscmd": "/usr/local/sv2/dev/desktop/usageparams.py {jobid}",
"client": {"cmd": null, "redir": "index.html?token={token}" },
"states": ["Finished"]
},
{ {
"name": "Remove log", "name": "Remove log",
"paramscmd": "/usr/local/sv2/dev/rmlog.py {jobid}", "paramscmd": "/usr/local/sv2/dev/rmlog.py {jobid}",
...@@ -42,6 +48,12 @@ ...@@ -42,6 +48,12 @@
"client": {"cmd": null, "redir": "index.html?token={token}" }, "client": {"cmd": null, "redir": "index.html?token={token}" },
"states": ["RUNNING","Finished"] "states": ["RUNNING","Finished"]
}, },
{
"name": "View Usage",
"paramscmd": "/usr/local/sv2/dev/desktop/usageparams.py {jobid}",
"client": {"cmd": null, "redir": "index.html?token={token}" },
"states": ["Finished"]
},
{ {
"name": "Remove log", "name": "Remove log",
"paramscmd": "/usr/local/sv2/dev/rmlog.py {jobid}", "paramscmd": "/usr/local/sv2/dev/rmlog.py {jobid}",
...@@ -63,6 +75,34 @@ ...@@ -63,6 +75,34 @@
"client": {"cmd": null, "redir": ""} "client": {"cmd": null, "redir": ""}
}], }],
"localbind": true,
"applist": null
},
{
"url": null,
"name": "History",
"startscript": "#!/bin/bash\n/usr/local/sv2/dev/desktop/desktop.slurm\n ",
"actions": [
{
"name": "Connect",
"paramscmd": "/usr/local/sv2/dev/jupyter/jupyter_params.py {jobid}",
"client": {"cmd": null, "redir": "?token={token}"},
"states": ["RUNNING"]
},
{
"name": "View Usage",
"paramscmd": "/usr/local/sv2/dev/desktop/usageparams.py {jobid}",
"client": {"cmd": null, "redir": "index.html?token={token}" },
"states": ["Finished"]
},
{
"name": "Remove log",
"paramscmd": "/usr/local/sv2/dev/rmlog.py {jobid}",
"client": null,
"states": ["Finished"]
}
],
"localbind": true, "localbind": true,
"applist": null "applist": null
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment