• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HicServices / RDMP / 9758065908

02 Jul 2024 09:03AM UTC coverage: 56.679% (-0.2%) from 56.914%
9758065908

push

github

web-flow
Release/8.2.0 (#1867)

* add extraction additions

* interim

* add test

* interim

* working dedupe

* improved checking

* add timestamp option

* fix extra looping

* add check

* start on tests

* tidy up code

* update link

* tidy up

* Rename executeFullExtractionToDatabaseMSSql.md to ExecuteFullExtractionToDatabaseMSSql.md

* fix typo

* add docs

* update

* update documentation

* attempt fix docs

* update docs

* tidy up code

* better tests

* add real test

* tidy up

* interim

* grab existiing entity

* no new data

* add basic tests

* attempt to fix test

* interim

* interim commit

* working clash

* add test

* fix test

* improved clash checker

* tidy up

* update test

* fix up test

* update from codeql

* tidy up code

* fix bad merge

* fix typo

* skip over for now

* revert change

* Task/RDMP-180 Add instance settings table (#1820)

* working settings interface

* add documentation

* add missing files

* update namespace

* add icon

* update from run

* make key unique

* add tests

* update tests

* update for tests

* fix unique name issue

* tidy up

* tidy up from review

* works

* nested deprications

* recursive deprication

* tidy up

* add newline

* Task/rdmp 174 dqe improvements (#1849)

* working scallable graph

* add changelog

* add axis override

* interim

* working increments

* working ui refresh

* update changelog

* tidy up code

* add missing file

* tidy up

* Task/rdmp 155 migrate catalogue tables (#1805)

* start of UI

* interim

* working switch

* improved ui

* fix build

* rename duped file

* imterim

* add checks

* start of tests

* local tests  working

* add tests

* improved ui

* tidy up

* add single item use

* broken test

* updated tests

* tidy up imports

* add some documentation

* fix docume... (continued)

10912 of 20750 branches covered (52.59%)

Branch coverage included in aggregate %.

369 of 831 new or added lines in 38 files covered. (44.4%)

375 existing lines in 25 files now uncovered.

30965 of 53135 relevant lines covered (58.28%)

7845.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Rdmp.Core/DataLoad/Engine/Job/Scheduling/MultipleScheduleJobFactory.cs
1
// Copyright (c) The University of Dundee 2018-2019
2
// This file is part of the Research Data Management Platform (RDMP).
3
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
6

7
using System.Collections.Generic;
8
using System.Linq;
9
using Rdmp.Core.Curation;
10
using Rdmp.Core.Curation.Data;
11
using Rdmp.Core.Curation.Data.DataLoad;
12
using Rdmp.Core.DataLoad.Engine.DatabaseManagement.EntityNaming;
13
using Rdmp.Core.Logging;
14
using Rdmp.Core.Repositories;
15
using Rdmp.Core.ReusableLibraryCode.Progress;
16

17
namespace Rdmp.Core.DataLoad.Engine.Job.Scheduling;
18

19
/// <summary>
20
/// Return a ScheduledDataLoadJob hydrated with appropriate dates for the LoadProgress supplied.  This class differs from SingleScheduledJobFactory only
21
/// in that it lets you pass multiple ILoadProgress instead of only one, the class will decide which is the next most sensible one to run.  For example
22
/// you might have 'Load Biochem For Tayside' and 'Load Biochem For Fife' as two LoadProgress in the LoadMetadata 'Loading Biochemistry', this class would
23
/// pick which one to execute next.
24
/// </summary>
25
public class MultipleScheduleJobFactory : ScheduledJobFactory
26
{
27
    private readonly Dictionary<ILoadProgress, IJobDateGenerationStrategy> _availableSchedules;
28
    private readonly List<ILoadProgress> _scheduleList;
29
    private int _lastScheduleId;
30

31
    public MultipleScheduleJobFactory(Dictionary<ILoadProgress, IJobDateGenerationStrategy> availableSchedules,
32
        int? overrideNumberOfDaysToLoad, ILoadMetadata loadMetadata, ILogManager logManager)
33
        : base(overrideNumberOfDaysToLoad, loadMetadata, logManager)
×
34
    {
35
        _availableSchedules = availableSchedules;
×
36

37
        _scheduleList = _availableSchedules.Keys.ToList();
×
38

39
        _lastScheduleId = 0;
×
40
    }
×
41

42
    /// <summary>
43
    /// Returns false only if no schedule has any jobs associated with it
44
    /// </summary>
45
    /// <returns></returns>
46
    public override bool HasJobs()
47
    {
48
        return _scheduleList.Any(loadProgress =>
×
49
            _availableSchedules[loadProgress]
×
50
                .GetTotalNumberOfJobs(OverrideNumberOfDaysToLoad ?? loadProgress.DefaultNumberOfDaysToLoadEachTime,
×
51
                    false) > 0);
×
52
    }
53

54
    protected override ScheduledDataLoadJob CreateImpl(IRDMPPlatformRepositoryServiceLocator repositoryLocator,
55
        IDataLoadEventListener listener, HICDatabaseConfiguration configuration)
56
    {
57
        var loadProgress = _scheduleList[_lastScheduleId];
×
58
        var datesToRetrieve = _availableSchedules[loadProgress]
×
59
            .GetDates(OverrideNumberOfDaysToLoad ?? _scheduleList[_lastScheduleId].DefaultNumberOfDaysToLoadEachTime,
×
60
                false);
×
61
        if (!datesToRetrieve.Any())
×
62
            return null;
×
63

NEW
64
        var LoadDirectory = new LoadDirectory(LoadMetadata.LocationOfForLoadingDirectory, LoadMetadata.LocationOfForArchivingDirectory, LoadMetadata.LocationOfExecutablesDirectory, LoadMetadata.LocationOfCacheDirectory);
×
65
        var job = new ScheduledDataLoadJob(repositoryLocator, JobDescription, LogManager, LoadMetadata, LoadDirectory,
×
66
            listener, configuration)
×
67
        {
×
68
            LoadProgress = loadProgress,
×
69
            DatesToRetrieve = datesToRetrieve
×
70
        };
×
71

72
        // move our circular pointer for the round-robin assignment
73
        _lastScheduleId = (_lastScheduleId + 1) % _scheduleList.Count;
×
74

75
        return job;
×
76
    }
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc