OLD | NEW |
1 // Functions and variables helping with communication with CT frontend. | 1 // Functions and variables helping with communication with CT frontend. |
2 package frontend | 2 package frontend |
3 | 3 |
4 import ( | 4 import ( |
5 "bytes" | 5 "bytes" |
6 "encoding/json" | 6 "encoding/json" |
7 "fmt" | 7 "fmt" |
8 "io/ioutil" | 8 "io/ioutil" |
9 "net/http" | 9 "net/http" |
10 "net/url" | 10 "net/url" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Webapp subparts. | 32 // Webapp subparts. |
33 AdminTasksWebapp string | 33 AdminTasksWebapp string |
34 UpdateAdminTasksWebapp string | 34 UpdateAdminTasksWebapp string |
35 UpdateRecreatePageSetsTasksWebapp string | 35 UpdateRecreatePageSetsTasksWebapp string |
36 UpdateRecreateWebpageArchivesTasksWebapp string | 36 UpdateRecreateWebpageArchivesTasksWebapp string |
37 LuaTasksWebapp string | 37 LuaTasksWebapp string |
38 UpdateLuaTasksWebapp string | 38 UpdateLuaTasksWebapp string |
39 CaptureSKPsTasksWebapp string | 39 CaptureSKPsTasksWebapp string |
40 UpdateCaptureSKPsTasksWebapp string | 40 UpdateCaptureSKPsTasksWebapp string |
41 ChromiumPerfTasksWebapp string | 41 ChromiumPerfTasksWebapp string |
| 42 ChromiumAnalysisTasksWebapp string |
42 UpdateChromiumPerfTasksWebapp string | 43 UpdateChromiumPerfTasksWebapp string |
43 ChromiumBuildTasksWebapp string | 44 ChromiumBuildTasksWebapp string |
44 UpdateChromiumBuildTasksWebapp string | 45 UpdateChromiumBuildTasksWebapp string |
45 GetOldestPendingTaskWebapp string | 46 GetOldestPendingTaskWebapp string |
46 ) | 47 ) |
47 | 48 |
48 var httpClient = httputils.NewTimeoutClient() | 49 var httpClient = httputils.NewTimeoutClient() |
49 | 50 |
50 // Initializes *Webapp URLs above and sets up authentication credentials for Upd
ateWebappTaskV2. | 51 // Initializes *Webapp URLs above and sets up authentication credentials for Upd
ateWebappTaskV2. |
51 func MustInit() { | 52 func MustInit() { |
(...skipping 16 matching lines...) Expand all Loading... |
68 WebappRoot = webapp_root | 69 WebappRoot = webapp_root |
69 AdminTasksWebapp = webapp_root + ctfeutil.ADMIN_TASK_URI | 70 AdminTasksWebapp = webapp_root + ctfeutil.ADMIN_TASK_URI |
70 UpdateAdminTasksWebapp = "" | 71 UpdateAdminTasksWebapp = "" |
71 UpdateRecreatePageSetsTasksWebapp = webapp_root + ctfeutil.UPDATE_RECREA
TE_PAGE_SETS_TASK_POST_URI | 72 UpdateRecreatePageSetsTasksWebapp = webapp_root + ctfeutil.UPDATE_RECREA
TE_PAGE_SETS_TASK_POST_URI |
72 UpdateRecreateWebpageArchivesTasksWebapp = webapp_root + ctfeutil.UPDATE
_RECREATE_WEBPAGE_ARCHIVES_TASK_POST_URI | 73 UpdateRecreateWebpageArchivesTasksWebapp = webapp_root + ctfeutil.UPDATE
_RECREATE_WEBPAGE_ARCHIVES_TASK_POST_URI |
73 LuaTasksWebapp = webapp_root + ctfeutil.LUA_SCRIPT_URI | 74 LuaTasksWebapp = webapp_root + ctfeutil.LUA_SCRIPT_URI |
74 UpdateLuaTasksWebapp = webapp_root + ctfeutil.UPDATE_LUA_SCRIPT_TASK_POS
T_URI | 75 UpdateLuaTasksWebapp = webapp_root + ctfeutil.UPDATE_LUA_SCRIPT_TASK_POS
T_URI |
75 CaptureSKPsTasksWebapp = webapp_root + ctfeutil.CAPTURE_SKPS_URI | 76 CaptureSKPsTasksWebapp = webapp_root + ctfeutil.CAPTURE_SKPS_URI |
76 UpdateCaptureSKPsTasksWebapp = webapp_root + ctfeutil.UPDATE_CAPTURE_SKP
S_TASK_POST_URI | 77 UpdateCaptureSKPsTasksWebapp = webapp_root + ctfeutil.UPDATE_CAPTURE_SKP
S_TASK_POST_URI |
77 ChromiumPerfTasksWebapp = webapp_root + ctfeutil.CHROMIUM_PERF_URI | 78 ChromiumPerfTasksWebapp = webapp_root + ctfeutil.CHROMIUM_PERF_URI |
| 79 ChromiumAnalysisTasksWebapp = webapp_root + ctfeutil.CHROMIUM_ANALYSIS_U
RI |
78 UpdateChromiumPerfTasksWebapp = webapp_root + ctfeutil.UPDATE_CHROMIUM_P
ERF_TASK_POST_URI | 80 UpdateChromiumPerfTasksWebapp = webapp_root + ctfeutil.UPDATE_CHROMIUM_P
ERF_TASK_POST_URI |
79 ChromiumBuildTasksWebapp = webapp_root + ctfeutil.CHROMIUM_BUILD_URI | 81 ChromiumBuildTasksWebapp = webapp_root + ctfeutil.CHROMIUM_BUILD_URI |
80 UpdateChromiumBuildTasksWebapp = webapp_root + ctfeutil.UPDATE_CHROMIUM_
BUILD_TASK_POST_URI | 82 UpdateChromiumBuildTasksWebapp = webapp_root + ctfeutil.UPDATE_CHROMIUM_
BUILD_TASK_POST_URI |
81 GetOldestPendingTaskWebapp = webapp_root + ctfeutil.GET_OLDEST_PENDING_T
ASK_URI | 83 GetOldestPendingTaskWebapp = webapp_root + ctfeutil.GET_OLDEST_PENDING_T
ASK_URI |
82 } | 84 } |
83 | 85 |
84 func UpdateWebappTask(gaeTaskID int64, webappURL string, extraData map[string]st
ring) error { | 86 func UpdateWebappTask(gaeTaskID int64, webappURL string, extraData map[string]st
ring) error { |
85 glog.Infof("Updating %s on %s with %s", gaeTaskID, webappURL, extraData) | 87 glog.Infof("Updating %s on %s with %s", gaeTaskID, webappURL, extraData) |
86 pwdBytes, err := ioutil.ReadFile(ctutil.WebappPasswordPath) | 88 pwdBytes, err := ioutil.ReadFile(ctutil.WebappPasswordPath) |
87 if err != nil { | 89 if err != nil { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return fmt.Errorf("Could not update webapp task, response status
code was %d: %s", resp.StatusCode, response) | 155 return fmt.Errorf("Could not update webapp task, response status
code was %d: %s", resp.StatusCode, response) |
154 } | 156 } |
155 return nil | 157 return nil |
156 } | 158 } |
157 | 159 |
158 func UpdateWebappTaskSetStarted(vars task_common.UpdateTaskVars, id int64) error
{ | 160 func UpdateWebappTaskSetStarted(vars task_common.UpdateTaskVars, id int64) error
{ |
159 vars.GetUpdateTaskCommonVars().Id = id | 161 vars.GetUpdateTaskCommonVars().Id = id |
160 vars.GetUpdateTaskCommonVars().SetStarted() | 162 vars.GetUpdateTaskCommonVars().SetStarted() |
161 return UpdateWebappTaskV2(vars) | 163 return UpdateWebappTaskV2(vars) |
162 } | 164 } |
OLD | NEW |