Skip to content

Commit d5a64a9

Browse files
authored
Attempt to improve JBrowseTest stability (#125)
* Attempt to improve JBrowseTest stability
1 parent f66afae commit d5a64a9

File tree

3 files changed

+99
-7
lines changed

3 files changed

+99
-7
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
GENERATE_DIST: ${{ steps.default-branch.branch == steps.extract-branch.branch && '1' || '0' }}
4646

4747
- name: Publish Release
48-
if: github.ref == '/refs/heads/${{ fromJson(steps.get_default_branch.outputs.data).default_branch }}' && github.event_name == 'push'
48+
if: github.ref == '/refs/heads/${{ fromJson(steps.get_default_branch.outputs.data).default_branch }}' && github.event_name == 'push' && github.base_ref == ''
4949
uses: "marvinpinto/action-automatic-releases@latest"
5050
with:
5151
repo_token: "${{ secrets.PAT }}"

cluster/src/org/labkey/cluster/ClusterController.java

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
import org.apache.logging.log4j.Logger;
2222
import org.labkey.api.action.ConfirmAction;
2323
import org.labkey.api.action.SpringActionController;
24+
import org.labkey.api.data.DbSchema;
25+
import org.labkey.api.data.DbSchemaType;
26+
import org.labkey.api.data.Table;
27+
import org.labkey.api.data.TableInfo;
2428
import org.labkey.api.pipeline.PipelineJob;
2529
import org.labkey.api.pipeline.PipelineJobException;
2630
import org.labkey.api.pipeline.PipelineJobService;
@@ -43,7 +47,9 @@
4347
import java.io.File;
4448
import java.io.IOException;
4549
import java.util.ArrayList;
50+
import java.util.HashMap;
4651
import java.util.List;
52+
import java.util.Map;
4753

4854
public class ClusterController extends SpringActionController
4955
{
@@ -162,6 +168,95 @@ public void setJobIds(String jobIds)
162168
}
163169
}
164170

171+
172+
public static class ResetPipelineJobLogFileForm
173+
{
174+
private int _jobId;
175+
private String _filePath;
176+
177+
public int getJobId()
178+
{
179+
return _jobId;
180+
}
181+
182+
public void setJobId(int jobId)
183+
{
184+
_jobId = jobId;
185+
}
186+
187+
public String getFilePath()
188+
{
189+
return _filePath;
190+
}
191+
192+
public void setFilePath(String filePath)
193+
{
194+
_filePath = filePath;
195+
}
196+
}
197+
198+
@RequiresSiteAdmin
199+
public class ResetPipelineJobLogFileAction extends ConfirmAction<ResetPipelineJobLogFileForm>
200+
{
201+
public void validateCommand(ResetPipelineJobLogFileForm form, Errors errors)
202+
{
203+
204+
}
205+
206+
public URLHelper getSuccessURL(ResetPipelineJobLogFileForm form)
207+
{
208+
return PageFlowUtil.urlProvider(PipelineStatusUrls.class).urlBegin(getContainer());
209+
}
210+
211+
public ModelAndView getConfirmView(ResetPipelineJobLogFileForm form, BindException errors) throws Exception
212+
{
213+
return new HtmlView(HtmlString.unsafe("This will change the PipelineJob log file path for the selected job to the path below." +
214+
"<br><br>" +
215+
"<label>Enter Job ID(s): </label><input name=\"jobId\"><br>" +
216+
"<label>New Filepath: </label><input name=\"filePath\"><br>"));
217+
}
218+
219+
@Override
220+
public boolean handlePost(ResetPipelineJobLogFileForm form, BindException errors) throws Exception
221+
{
222+
if (form.getJobId() == 0)
223+
{
224+
errors.reject(ERROR_MSG, "No JobId provided");
225+
return false;
226+
}
227+
228+
PipelineStatusFile sf = PipelineService.get().getStatusFile(form.getJobId());
229+
if (sf == null)
230+
{
231+
errors.reject(ERROR_MSG, "Unable to find job: " + form.getJobId());
232+
return false;
233+
}
234+
235+
String path = StringUtils.trimToNull(form.getFilePath());
236+
if (path == null)
237+
{
238+
errors.reject(ERROR_MSG, "Missing filepath: " + form.getFilePath());
239+
return false;
240+
}
241+
242+
File logFile = new File(path);
243+
if (!logFile.exists())
244+
{
245+
errors.reject(ERROR_MSG, "File doesnt exist: " + form.getFilePath());
246+
return false;
247+
}
248+
249+
Map<String, Object> toUpdate = new HashMap<>();
250+
toUpdate.put("RowId", form.getJobId());
251+
toUpdate.put("FilePath", path);
252+
253+
TableInfo ti = DbSchema.get("pipeline", DbSchemaType.Module).getTable("StatusFiles");
254+
Table.update(getUser(), ti, toUpdate, form.getJobId());
255+
256+
return false;
257+
}
258+
}
259+
165260
@RequiresSiteAdmin
166261
public class RecoverCompletedJobsAction extends ConfirmAction<JobIdsForm>
167262
{
@@ -212,7 +307,6 @@ public boolean handlePost(JobIdsForm form, BindException errors) throws Exceptio
212307
}
213308

214309
sfs.forEach(sf -> {
215-
216310
File log = new File(sf.getFilePath());
217311
File json = AbstractClusterExecutionEngine.getSerializedJobFile(log);
218312
if (!json.exists())

jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ private void testSampleFiltersFromUrl()
309309
beginAt("/home/jbrowse-jbrowse.view?session=mgap&sampleFilters=mgap:m00010");
310310
waitForJBrowseToLoad();
311311

312+
// NOTE: this should be replaced with something more specific
313+
sleep(5000);
314+
312315
// Wait for variants to load:
313316
getDriver().findElements(getVariantWithinTrack("mgap_hg38", "SNV A -> T"));
314317

@@ -346,11 +349,6 @@ private By getVariantWithinTrack(String trackId, String variantText)
346349
l = l.append(Locator.xpath("//*[name()='text' and contains(text(), '" + variantText + "')]/..")).notHidden();
347350

348351
waitForElementToDisappear(Locator.tagWithText("p", "Loading"));
349-
sleep(250);
350-
waitForElement(l);
351-
352-
waitForElementToDisappear(Locator.tagWithText("p", "Loading"));
353-
sleep(250);
354352
waitForElement(l);
355353

356354
return By.xpath(l.toXpath());

0 commit comments

Comments
 (0)