Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/21/10 18:18:54 (14 years ago)
Author:
cneumuel
Message:

#1233

  • minor changes
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs

    r5137 r5155  
    8585
    8686    #region Job Methods
    87     public Guid AddJob(Job job, JobData jobData) {
     87    public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds) {
    8888      job.Id = Guid.NewGuid();
    8989      jobData.JobId = job.Id;
     
    9393    }
    9494
    95     public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
     95    public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds) {
    9696      job.Id = Guid.NewGuid();
    9797      job.ParentJobId = parentJobId;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs

    r5106 r5155  
    282282      } else {
    283283        // response = service.AddJobWithGroupStrings(serializedJob, groups);
    284         hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData);
     284        hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, null); // todo: use ResourceIds
    285285      }
    286286
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs

    r5106 r5155  
    1515    #region Job Methods
    1616    [OperationContract]
    17     Guid AddJob(Job job, JobData jobData);
     17    Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds);
    1818
    1919    [OperationContract]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r5106 r5155  
    5757    }
    5858
    59     public IEnumerable<DT.Job> GetAvailableParentJobs(Guid slaveId) {
     59    public IEnumerable<DT.Job> GetWaitingParentJobs(Guid slaveId) {
    6060      using (var db = CreateContext()) {
    6161        // todo: slaveId is unused!
     
    8080                    orderby j.Priority descending
    8181                    select Convert.ToDto(j);
    82         return query.Union(GetAvailableParentJobs(slave.Id)).OrderByDescending(x => x.Priority).ToArray();
     82        return query.Union(GetWaitingParentJobs(slave.Id)).OrderByDescending(x => x.Priority).ToArray();
    8383      }
    8484    }
     
    363363        if (entity != null) db.Resources.DeleteOnSubmit(entity);
    364364        db.SubmitChanges();
     365      }
     366    }
     367
     368    public void AssignJobToResource(Guid jobId, Guid resourceId) {
     369      using (var db = CreateContext()) {
     370        var job = db.Jobs.Where(x => x.JobId == jobId).Single();
     371        job.AssignedResources.Add(new AssignedResource() { JobId = jobId, ResourceId = resourceId });
     372        db.SubmitChanges();
     373      }
     374    }
     375
     376    public IEnumerable<DT.Resource> GetAssignedResources(Guid jobId) {
     377      using (var db = CreateContext()) {
     378        var job = db.Jobs.Where(x => x.JobId == jobId).Single();
     379        return job.AssignedResources.Select(x => Convert.ToDto(x.Resource)).ToArray();
    365380      }
    366381    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r5106 r5155  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 16.25, 12.25" name="HiveDataContext">
     2<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 15.75, 8.5" name="HiveDataContext">
    33  <DataContextMoniker Name="/HiveDataContext" />
    44  <nestedChildShapes>
    5     <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="12.75, 2.875, 2, 1.3862939453124987">
     5    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3.75, 2, 1.3862939453124987">
    66      <DataClassMoniker Name="/HiveDataContext/AssignedResource" />
    77      <nestedChildShapes>
    8         <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="12.765, 3.3350000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     8        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.2100000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    99      </nestedChildShapes>
    1010    </classShape>
    11     <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 10.625, 2, 1.3862939453125005">
     11    <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1.3862939453125005">
    1212      <DataClassMoniker Name="/HiveDataContext/Plugin" />
    1313      <nestedChildShapes>
    14         <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 11.085, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     14        <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    1515      </nestedChildShapes>
    1616    </classShape>
    17     <classShape Id="97b00810-fa30-457e-b484-b4e80b22f91b" absoluteBounds="9.25, 8.875, 2, 1.3862939453124987">
     17    <classShape Id="97b00810-fa30-457e-b484-b4e80b22f91b" absoluteBounds="6.5, 5.5, 2, 1.3862939453124987">
    1818      <DataClassMoniker Name="/HiveDataContext/RequiredPlugin" />
    1919      <nestedChildShapes>
    20         <elementListCompartment Id="df6451e5-069e-4ca0-a909-61b8213b5047" absoluteBounds="9.265, 9.335, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     20        <elementListCompartment Id="df6451e5-069e-4ca0-a909-61b8213b5047" absoluteBounds="6.5150000000000006, 5.9600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    2121      </nestedChildShapes>
    2222    </classShape>
    23     <classShape Id="706a4581-6daf-4e71-ae2a-87d50b27a051" absoluteBounds="11.75, 0.75, 2, 1.5785953776041666">
     23    <classShape Id="706a4581-6daf-4e71-ae2a-87d50b27a051" absoluteBounds="11.25, 1, 2, 1.5785953776041666">
    2424      <DataClassMoniker Name="/HiveDataContext/Resource" />
    2525      <nestedChildShapes>
    26         <elementListCompartment Id="8c24f5bf-2164-4d0f-832e-1730eb0066df" absoluteBounds="11.765, 1.21, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     26        <elementListCompartment Id="8c24f5bf-2164-4d0f-832e-1730eb0066df" absoluteBounds="11.265, 1.46, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    2727      </nestedChildShapes>
    2828    </classShape>
    29     <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="9.25, 4.375, 2, 3.5016097005208326">
     29    <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.5016097005208326">
    3030      <DataClassMoniker Name="/HiveDataContext/Job" />
    3131      <nestedChildShapes>
    32         <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="9.265, 4.835, 1.9700000000000002, 2.941609700520833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     32        <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.941609700520833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    3333      </nestedChildShapes>
    3434    </classShape>
    35     <classShape Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" absoluteBounds="11.75, 4.625, 2, 2.1554996744791666">
     35    <classShape Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" absoluteBounds="13.5, 2.5, 2, 2.1554996744791666">
    3636      <DataClassMoniker Name="/HiveDataContext/UptimeCalendar" />
    3737      <nestedChildShapes>
    38         <elementListCompartment Id="7d8f121b-35bb-4753-a25f-3fac1562e68e" absoluteBounds="11.765, 5.0850000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     38        <elementListCompartment Id="7d8f121b-35bb-4753-a25f-3fac1562e68e" absoluteBounds="13.515, 2.9600000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    3939      </nestedChildShapes>
    4040    </classShape>
    41     <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.875, 6, 2, 2.1554996744791666">
     41    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.1554996744791666">
    4242      <DataClassMoniker Name="/HiveDataContext/HiveExperiment" />
    4343      <nestedChildShapes>
    44         <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.8900000000000006, 6.4600000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     44        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    4545      </nestedChildShapes>
    4646    </classShape>
    47     <classShape Id="26f4edfa-91dd-4941-a058-359f89e567a8" absoluteBounds="9.375, 0.75, 2, 2.3478011067708335">
     47    <classShape Id="26f4edfa-91dd-4941-a058-359f89e567a8" absoluteBounds="8.875, 1, 2, 2.3478011067708335">
    4848      <DataClassMoniker Name="/HiveDataContext/Slave" />
    4949      <nestedChildShapes>
    50         <elementListCompartment Id="1e61f36b-08dc-4df7-8594-c9dcd95c0791" absoluteBounds="9.39, 1.21, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     50        <elementListCompartment Id="1e61f36b-08dc-4df7-8594-c9dcd95c0791" absoluteBounds="8.89, 1.46, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    5151      </nestedChildShapes>
    5252    </classShape>
    53     <classShape Id="bbd91675-92f2-4a69-8429-0950008fc8a4" absoluteBounds="14, 0.75, 2, 0.8093896484375">
     53    <classShape Id="bbd91675-92f2-4a69-8429-0950008fc8a4" absoluteBounds="13.5, 1, 2, 0.8093896484375">
    5454      <DataClassMoniker Name="/HiveDataContext/SlaveGroup" />
    5555      <nestedChildShapes>
    56         <elementListCompartment Id="5a790e8f-6e2e-4bf5-bd2b-f8a82224d9d7" absoluteBounds="14, 0.75, 0.125, 0.2493896484375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     56        <elementListCompartment Id="5a790e8f-6e2e-4bf5-bd2b-f8a82224d9d7" absoluteBounds="13.5, 1, 0.125, 0.2493896484375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    5757      </nestedChildShapes>
    5858    </classShape>
    59     <inheritanceConnector edgePoints="[(11.75 : 1.53929768880208); (11.375 : 1.53929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
     59    <inheritanceConnector edgePoints="[(11.25 : 1.78929768880208); (10.875 : 1.78929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
    6060      <nodes>
    6161        <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
     
    6363      </nodes>
    6464    </inheritanceConnector>
    65     <inheritanceConnector edgePoints="[(13.75 : 1.15469482421875); (14 : 1.15469482421875)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
     65    <inheritanceConnector edgePoints="[(13.25 : 1.40469482421875); (13.5 : 1.40469482421875)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
    6666      <nodes>
    6767        <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
     
    6969      </nodes>
    7070    </inheritanceConnector>
    71     <associationConnector edgePoints="[(13.25 : 2.32859537760417); (13.25 : 2.875)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     71    <associationConnector edgePoints="[(12.25 : 2.57859537760417); (12.25 : 4.44314697265625); (10.875 : 4.44314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7272      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
    7373      <nodes>
     
    7676      </nodes>
    7777    </associationConnector>
    78     <associationConnector edgePoints="[(11.25 : 7.20274983723958); (14.34375 : 7.20274983723958); (14.34375 : 4.2612939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     78    <associationConnector edgePoints="[(8.5 : 4.12580485026042); (8.875 : 4.12580485026042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7979      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
    8080      <nodes>
     
    8383      </nodes>
    8484    </associationConnector>
    85     <associationConnector edgePoints="[(10.25 : 7.87660970052083); (10.25 : 8.875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     85    <associationConnector edgePoints="[(7.1210551923077 : 4.50160970052083); (7.1210551923077 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    8686      <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
    8787      <nodes>
     
    9090      </nodes>
    9191    </associationConnector>
    92     <associationConnector edgePoints="[(11.0834359271285 : 7.87660970052083); (11.0834359271285 : 7.95910970052083); (11.1656121961154 : 7.95910970052083); (11.1656121961154 : 8.12660970052083); (10.5546153846154 : 8.12660970052083); (10.5546153846154 : 7.87660970052083)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed">
     92    <associationConnector edgePoints="[(8.3334359271285 : 4.50160970052083); (8.3334359271285 : 4.58410970052083); (8.4156121961154 : 4.58410970052083); (8.4156121961154 : 4.75160970052083); (7.8046153846154 : 4.75160970052083); (7.8046153846154 : 4.50160970052083)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed">
    9393      <AssociationMoniker Name="/HiveDataContext/Job/Job_Job" />
    9494      <nodes>
     
    9797      </nodes>
    9898    </associationConnector>
    99     <associationConnector edgePoints="[(10.3125 : 3.09780110677083); (10.3125 : 4.375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     99    <associationConnector edgePoints="[(8.875 : 2.17390055338542); (8.5 : 2.17390055338542)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    100100      <AssociationMoniker Name="/HiveDataContext/Slave/Slave_Job" />
    101101      <nodes>
     
    104104      </nodes>
    105105    </associationConnector>
    106     <associationConnector edgePoints="[(12.21875 : 2.32859537760417); (12.21875 : 4.625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     106    <associationConnector edgePoints="[(12.781252 : 2.57859537760417); (12.781252 : 3.54212367513021); (13.5 : 3.54212367513021)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    107107      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" />
    108108      <nodes>
     
    111111      </nodes>
    112112    </associationConnector>
    113     <associationConnector edgePoints="[(9.25 : 6.93830485026042); (6.875 : 6.93830485026042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     113    <associationConnector edgePoints="[(6.5 : 3.56330485026042); (6.125 : 3.56330485026042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    114114      <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" />
    115115      <nodes>
     
    118118      </nodes>
    119119    </associationConnector>
    120     <classShape Id="6bc13f26-f9a8-4597-b054-35be34190d12" absoluteBounds="6.875, 4.375, 2, 1.3862939453124996">
     120    <classShape Id="6bc13f26-f9a8-4597-b054-35be34190d12" absoluteBounds="4.125, 1, 2, 1.3862939453124996">
    121121      <DataClassMoniker Name="/HiveDataContext/JobData" />
    122122      <nestedChildShapes>
    123         <elementListCompartment Id="a068522c-7974-4679-b356-e33c941c465b" absoluteBounds="6.89, 4.835, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     123        <elementListCompartment Id="a068522c-7974-4679-b356-e33c941c465b" absoluteBounds="4.14, 1.46, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    124124      </nestedChildShapes>
    125125    </classShape>
    126     <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.5, 10.625, 2, 1.1939925130208344">
     126    <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.375, 5.5, 2, 1.1939925130208344">
    127127      <DataClassMoniker Name="/HiveDataContext/PluginData" />
    128128      <nestedChildShapes>
    129         <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.515, 11.085, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     129        <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.39, 5.9600000000000009, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    130130      </nestedChildShapes>
    131131    </classShape>
    132     <associationConnector edgePoints="[(11 : 11.2219962565104); (11.5 : 11.2219962565104)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     132    <associationConnector edgePoints="[(11 : 6.09699625651042); (11.375 : 6.09699625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    133133      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
    134134      <nodes>
     
    137137      </nodes>
    138138    </associationConnector>
    139     <associationConnector edgePoints="[(9.25 : 5.06814697265625); (8.875 : 5.06814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     139    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    140140      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
    141141      <nodes>
     
    144144      </nodes>
    145145    </associationConnector>
    146     <associationConnector edgePoints="[(10.125 : 10.625); (10.125 : 10.2612939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     146    <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    147147      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
    148148      <nodes>
     
    151151      </nodes>
    152152    </associationConnector>
    153     <associationConnector edgePoints="[(12.4524234637921 : 0.75); (12.4524234637921 : 0.5); (13.0617468474559 : 0.5); (13.0617468474559 : 0.75)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     153    <associationConnector edgePoints="[(11.9524234637921 : 1); (11.9524234637921 : 0.75); (12.5617468474559 : 0.75); (12.5617468474559 : 1)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    154154      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Resource" />
    155155      <nodes>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs

    r4905 r5155  
    7575    void UpdateResource(DT.Resource dto);
    7676    void DeleteResource(Guid id);
     77    void AssignJobToResource(Guid jobId, Guid resourceId);
     78    IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
    7779    #endregion
    7880
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r5106 r5155  
    3333      DT.Job job1 = new DT.Job();
    3434      job1.DateCreated = DateTime.Now;
    35       job1.JobState = JobState.Waiting;
    3635      job1.Id = dao.AddJob(job1);
    3736
     
    4645
    4746      Assert.AreEqual(null, dao.GetJob(job1.Id));
     47    }
    4848
     49    [TestMethod]
     50    public void TestSlaveDao() {
     51      IHiveDao dao = ServiceLocator.Instance.HiveDao;
    4952      DT.SlaveGroup slaveGroup = new DT.SlaveGroup() {
    5053        Name = "Test"
     
    5255      slaveGroup.Id = dao.AddSlaveGroup(slaveGroup);
    5356
     57      DT.Slave slave = new DT.Slave() {
     58        Name = "Test"
     59      };
     60      slave.Id= dao.AddSlave(slave);
     61
     62      dao.DeleteSlave(slave.Id);
    5463      dao.DeleteSlaveGroup(slaveGroup.Id);
     64    }
     65
     66    [TestMethod]
     67    public void TestJobDaoWaiting() {
     68      IHiveDao dao = ServiceLocator.Instance.HiveDao;
     69
     70      DT.Job job = new DT.Job();
     71      job.DateCreated = DateTime.Now;
     72      job.JobState = JobState.Waiting;
     73      job.Id = dao.AddJob(job);
     74
     75
    5576    }
    5677  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs

    r5106 r5155  
    4848      };
    4949
    50       job.Id = service.AddJob(job, jobData);
     50      job.Id = service.AddJob(job, jobData, null);
    5151      experiment.RootJobId = job.Id;
    5252
     
    8989        };
    9090        JobData jobData = new JobData() { Data = PersistenceUtil.Serialize(new MockJob(500, false)) };
    91         job.Id = service.AddJob(job, jobData);
     91        job.Id = service.AddJob(job, jobData, null);
    9292        jobs.Add(job);
    9393      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r5106 r5155  
    3535    //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    3636    //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    37     public Guid AddJob(Job job, JobData jobData) {
     37    public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds) {
    3838      using (trans.OpenTransaction()) {
    3939        job.UserId = auth.UserId;
    4040        job.DateCreated = DateTime.Now;
    4141        job.JobState = JobState.Waiting;
    42         jobData.JobId = dao.AddJob(job);
     42        job.Id = dao.AddJob(job);
     43        jobData.JobId = job.Id;
    4344        jobData.LastUpdate = DateTime.Now;
     45        if (slaveGroupIds != null) {
     46          foreach (Guid slaveGroupId in slaveGroupIds) {
     47            dao.AssignJobToResource(job.Id, slaveGroupId);
     48          }
     49        } else {
     50          // todo: use default group
     51        }
    4452        dao.AddJobData(jobData);
    4553        return jobData.JobId;
     
    5058      using (trans.OpenTransaction()) {
    5159        job.ParentJobId = parentJobId;
    52         jobData.LastUpdate = DateTime.Now;
    53         return AddJob(job, jobData);
     60        return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));
    5461      }
    5562    }
Note: See TracChangeset for help on using the changeset viewer.