22
33import org .apache .xmlbeans .XmlException ;
44import org .jetbrains .annotations .NotNull ;
5+ import org .labkey .api .data .SimpleFilter ;
6+ import org .labkey .api .data .TableInfo ;
7+ import org .labkey .api .data .TableSelector ;
58import org .labkey .api .di .TaskRefTask ;
9+ import org .labkey .api .jbrowse .JBrowseService ;
610import org .labkey .api .pipeline .PipelineJob ;
711import org .labkey .api .pipeline .PipelineJobException ;
812import org .labkey .api .pipeline .RecordedActionSet ;
13+ import org .labkey .api .query .FieldKey ;
14+ import org .labkey .api .query .QueryService ;
15+ import org .labkey .api .query .UserSchema ;
16+ import org .labkey .api .util .PageFlowUtil ;
917import org .labkey .api .writer .ContainerUser ;
18+ import org .labkey .mgap .mGAPSchema ;
1019
1120import java .util .List ;
1221import java .util .Map ;
@@ -19,6 +28,26 @@ public class PerformQueuedEtlWorkTask implements TaskRefTask
1928 public RecordedActionSet run (@ NotNull PipelineJob job ) throws PipelineJobException
2029 {
2130 EtlQueueManager .get ().performQueuedWork (_containerUser .getContainer (), job .getLogger ());
31+
32+ // clear/warm caches:
33+ final TableInfo dbm = QueryService .get ().getUserSchema (_containerUser .getUser (), _containerUser .getContainer (), "jbrowse" ).getTable ("database_members" );
34+ new TableSelector (QueryService .get ().getUserSchema (_containerUser .getUser (), _containerUser .getContainer (), mGAPSchema .NAME ).getTable (mGAPSchema .TABLE_VARIANT_CATALOG_RELEASES ), PageFlowUtil .set ("objectId" , "jbrowseId" )).forEachResults (rs -> {
35+ String jbrowseId = rs .getString (FieldKey .fromString ("jbrowseId" ));
36+ List <String > trackIds = new TableSelector (dbm , PageFlowUtil .set ("objectid" ), new SimpleFilter (FieldKey .fromString ("database" ), jbrowseId ).addCondition (FieldKey .fromString ("jsonfile/outputfile/name" ), "mGAP Release" ), null ).getArrayList (String .class );
37+ if (trackIds .isEmpty ())
38+ {
39+ job .getLogger ().error ("No mGAP Release track found for session: " + jbrowseId );
40+ }
41+ else if (trackIds .size () > 1 )
42+ {
43+ job .getLogger ().error ("More than one mGAP Release track found for session: " + jbrowseId );
44+ }
45+ else
46+ {
47+ JBrowseService .get ().cacheDefaultQuery (_containerUser .getUser (), rs .getString (FieldKey .fromString ("objectId" )), trackIds .get (0 ));
48+ }
49+ });
50+
2251 return new RecordedActionSet ();
2352 }
2453
0 commit comments