Created
April 23, 2015 11:37
-
-
Save sbinet/af685fe40e12a645e5f8 to your computer and use it in GitHub Desktop.
panda scrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"net/http" | |
"time" | |
) | |
var ( | |
tid = flag.Int("tid", 5336712, "jedi task id") | |
pandaid = flag.Int64("panda-id", 2458702277, "panda id") | |
) | |
func main() { | |
flag.Parse() | |
url := "http://bigpanda.cern.ch/jobs/?jeditaskid=%d&dump=parameters@pandaid=%d" | |
req, err := http.NewRequest("GET", fmt.Sprintf(url, *tid, *pandaid), nil) | |
if err != nil { | |
panic(err) | |
} | |
req.Header.Add("Accept", "application/json") | |
req.Header.Add("Content-Type", "application/json") | |
resp, err := http.DefaultClient.Do(req) | |
if err != nil { | |
panic(err) | |
} | |
r := resp.Body | |
// r, err := os.Open("panda.json") | |
if err != nil { | |
panic(err) | |
} | |
defer r.Close() | |
data := make([]Data, 0) | |
err = json.NewDecoder(r).Decode(&data) | |
if err != nil { | |
panic(err) | |
} | |
for _, info := range data { | |
endtime, err := time.Parse("2006-01-02T15:04:05", info.Endtime) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf(">>> id=%-8d attempt=%02d duration=%+10s end=%v\n", | |
info.Pandaid, | |
info.Attemptnr, | |
time.Duration(info.Durationsec)*time.Second, | |
endtime, | |
) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
type Data struct { | |
Actualcorecount interface{} `json:"actualcorecount"` | |
Assignedpriority int64 `json:"assignedpriority"` | |
Atlasrelease string `json:"atlasrelease"` | |
Attemptnr int64 `json:"attemptnr"` | |
Batchid string `json:"batchid"` | |
Brokerageerrorcode int64 `json:"brokerageerrorcode"` | |
Brokerageerrordiag string `json:"brokerageerrordiag"` | |
Cloud string `json:"cloud"` | |
Cmtconfig string `json:"cmtconfig"` | |
Commandtopilot string `json:"commandtopilot"` | |
Computingelement string `json:"computingelement"` | |
Computingsite string `json:"computingsite"` | |
Corecount int64 `json:"corecount"` | |
Countrygroup string `json:"countrygroup"` | |
Cpuconsumptiontime int64 `json:"cpuconsumptiontime"` | |
Cpuconsumptionunit string `json:"cpuconsumptionunit"` | |
Cpuconversion string `json:"cpuconversion"` | |
Creationhost string `json:"creationhost"` | |
Creationtime string `json:"creationtime"` | |
Currentpriority int64 `json:"currentpriority"` | |
Ddmerrorcode int64 `json:"ddmerrorcode"` | |
Ddmerrordiag string `json:"ddmerrordiag"` | |
Destinationdblock string `json:"destinationdblock"` | |
Destinationse string `json:"destinationse"` | |
Destinationsite string `json:"destinationsite"` | |
Dispatchdblock string `json:"dispatchdblock"` | |
Duration string `json:"duration"` | |
Durationsec int64 `json:"durationsec"` | |
Endtime string `json:"endtime"` | |
Errorinfo string `json:"errorinfo"` | |
Exeerrorcode int64 `json:"exeerrorcode"` | |
Exeerrordiag string `json:"exeerrordiag"` | |
Grid string `json:"grid"` | |
Homecloud string `json:"homecloud"` | |
Homepackage string `json:"homepackage"` | |
Inputfilebytes int64 `json:"inputfilebytes"` | |
Inputfileproject string `json:"inputfileproject"` | |
Inputfiletype string `json:"inputfiletype"` | |
Ipconnectivity string `json:"ipconnectivity"` | |
Jeditaskid int64 `json:"jeditaskid"` | |
Jobdefinitionid int64 `json:"jobdefinitionid"` | |
Jobdispatchererrorcode int64 `json:"jobdispatchererrorcode"` | |
Jobdispatchererrordiag string `json:"jobdispatchererrordiag"` | |
Jobexecutionid int64 `json:"jobexecutionid"` | |
Jobinfo string `json:"jobinfo"` | |
Jobmetrics string `json:"jobmetrics"` | |
Jobname string `json:"jobname"` | |
Jobparameters string `json:"jobparameters"` | |
Jobsetid int64 `json:"jobsetid"` | |
Jobsetrange string `json:"jobsetrange"` | |
Jobstatus string `json:"jobstatus"` | |
Lockedby string `json:"lockedby"` | |
Maxattempt int64 `json:"maxattempt"` | |
Maxcpucount int64 `json:"maxcpucount"` | |
Maxcpuunit string `json:"maxcpuunit"` | |
Maxdiskcount int64 `json:"maxdiskcount"` | |
Maxdiskunit string `json:"maxdiskunit"` | |
Metadata string `json:"metadata"` | |
Metastruct interface{} `json:"metastruct"` | |
Minramcount int64 `json:"minramcount"` | |
Minramunit string `json:"minramunit"` | |
Modificationhost string `json:"modificationhost"` | |
Modificationtime string `json:"modificationtime"` | |
Nevents int64 `json:"nevents"` | |
Ninputdatafiles int64 `json:"ninputdatafiles"` | |
Ninputfiles interface{} `json:"ninputfiles"` | |
Noutputdatafiles int64 `json:"noutputdatafiles"` | |
Outputfilebytes int64 `json:"outputfilebytes"` | |
Outputfiletype string `json:"outputfiletype"` | |
Pandaid int64 `json:"pandaid"` | |
Parentid interface{} `json:"parentid"` | |
Piloterrorcode int64 `json:"piloterrorcode"` | |
Piloterrordiag string `json:"piloterrordiag"` | |
Pilotid string `json:"pilotid"` | |
Pilottiming string `json:"pilottiming"` | |
Priorityrange string `json:"priorityrange"` | |
Processingtype string `json:"processingtype"` | |
Proddblock string `json:"proddblock"` | |
Proddbupdatetime string `json:"proddbupdatetime"` | |
Prodserieslabel string `json:"prodserieslabel"` | |
Prodsourcelabel string `json:"prodsourcelabel"` | |
Produserid string `json:"produserid"` | |
Produsername string `json:"produsername"` | |
Relocationflag int64 `json:"relocationflag"` | |
Reqid int64 `json:"reqid"` | |
Schedulerid string `json:"schedulerid"` | |
Sourcesite string `json:"sourcesite"` | |
Specialhandling string `json:"specialhandling"` | |
Starttime string `json:"starttime"` | |
Statechangetime string `json:"statechangetime"` | |
Superrorcode int64 `json:"superrorcode"` | |
Superrordiag string `json:"superrordiag"` | |
Taskbuffererrorcode int64 `json:"taskbuffererrorcode"` | |
Taskbuffererrordiag string `json:"taskbuffererrordiag"` | |
Taskid int64 `json:"taskid"` | |
Transexitcode string `json:"transexitcode"` | |
Transfertype string `json:"transfertype"` | |
Transformation string `json:"transformation"` | |
Vo string `json:"vo"` | |
Waittime string `json:"waittime"` | |
Workinggroup string `json:"workinggroup"` | |
WorkqueueId int64 `json:"workqueue_id"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment