artifactDownloadQueueCap)
exitOnErr("failed to initialize ArtifactManager ", err)
bor := client.NewBorutaClient(borutaAddress)
- djm := manager.NewDryadJobManager()
+ djm := manager.NewDryadJobManager(artifactDBLocation)
jm := controller.NewJobManager(am, &yap, bor, borutaRefreshPeriod, djm)
api := operations.NewWelesAPI(swaggerSpec)
// newDryadJob creates an instance of dryadJob and starts a goroutine
// executing phases of given job implemented by provider of DryadJobRunner interface.
func newDryadJob(job weles.JobID, rusalka weles.Dryad, conf weles.Config,
- changes chan<- weles.DryadJobStatusChange) *dryadJob {
+ changes chan<- weles.DryadJobStatusChange, artifactDBPath string) *dryadJob {
- // FIXME: It should use the proper path to the artifactory.
- session := dryad.NewSessionProvider(rusalka, "")
+ session := dryad.NewSessionProvider(rusalka, artifactDBPath)
device := dryad.NewDeviceCommunicationProvider(session)
ctx, cancel := context.WithCancel(context.Background())
// DryadJobs implements DryadJobManager interface.
type DryadJobs struct {
weles.DryadJobManager
- jobs map[weles.JobID]*dryadJob
- jobsMutex *sync.RWMutex
+ jobs map[weles.JobID]*dryadJob
+ jobsMutex *sync.RWMutex
+ artifactDBPath string
}
// NewDryadJobManager returns DryadJobManager interface of a new instance of DryadJobs.
-func NewDryadJobManager() weles.DryadJobManager {
+func NewDryadJobManager(artifactDBPath string) weles.DryadJobManager {
return &DryadJobs{
- jobs: make(map[weles.JobID]*dryadJob),
- jobsMutex: new(sync.RWMutex),
+ jobs: make(map[weles.JobID]*dryadJob),
+ jobsMutex: new(sync.RWMutex),
+ artifactDBPath: artifactDBPath,
}
}
d.jobsMutex.Lock()
defer d.jobsMutex.Unlock()
// FIXME(amistewicz): dryadJobs should not be stored indefinitely.
- d.jobs[job] = newDryadJob(job, rusalka, conf, changes)
+ d.jobs[job] = newDryadJob(job, rusalka, conf, changes, d.artifactDBPath)
return nil
}
var _ = Describe("DryadJobManager", func() {
var djm DryadJobManager
jobID := JobID(666)
+ artifactDBPath := "/artifact/db/path"
BeforeEach(func() {
- djm = NewDryadJobManager()
+ djm = NewDryadJobManager(artifactDBPath)
})
create := func() {