agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/scheduling/AbstractJobSchedulingTest.java
/**
	 * Creates a distribution of jobs uniformly spread across all users.
	 * 
	 * @param totalJobs number of jobs to create
	 * @return Map of usernames to a list of UUID for the jobs created for that user
	 * @throws Exception 
	 */
Creates a distribution of jobs uniformly spread across all users.

@param totalJobs number of jobs to create
@return Map of usernames to a list of UUID for the jobs created for that user
@throws Exception
Creates a distribution of jobs uniformly spread across all users . @param totalJobs number of jobs to create @return Map of usernames to a list of UUID for the jobs created for that user @throws Exception
protected TreeMap<String,List<String>> loadRandomDistributionOfJobsForSingleApp(int totalJobs, JobStatusType status) 
	throws Exception {
		TreeMap<String,List<String>> jobDistribution = new TreeMap<String,List<String>>();
		Integer[] weights = new Integer[TEST_USER_COUNT];
		for (int i=0;i<TEST_USER_COUNT;i++) {
			jobDistribution.put(testUsernames.get(i), new ArrayList<String>());
			weights[i] = RandomUtils.nextInt(TEST_USER_COUNT-1)+1;
		}
		List<List<Integer>> buckets = TaskDistributor.getDistribution(weights, totalJobs);
		Software software = createSoftware();
		for (int i=0;i<TEST_USER_COUNT; i++)
		{
			String username = "user-"+i;
			for(int j=0; j<buckets.get(i).size(); j++)
			{
				Job job = createJob(status, software);
				jobDistribution.get(username).add(job.getUuid());
			}
		}
		return jobDistribution;
	}
protected TreeMap < String , List < String > > loadRandomDistributionOfJobsForSingleApp ( int totalJobs , JobStatusType status ) throws Exception { TreeMap < String , List < String > > jobDistribution = new TreeMap < String , List < String > > ( ) ; Integer [ ] weights = new Integer [ TEST_USER_COUNT ] ; for ( int i = 0 ; i < TEST_USER_COUNT ; i ++ ) { jobDistribution . put ( testUsernames . get ( i ) , new ArrayList < String > ( ) ) ; weights [ i ] = RandomUtils . nextInt ( TEST_USER_COUNT - 1 ) + 1 ; } List < List < Integer > > buckets = TaskDistributor . getDistribution ( weights , totalJobs ) ; Software software = createSoftware ( ) ; for ( int i = 0 ; i < TEST_USER_COUNT ; i ++ ) { String username = "user-" + i ; for ( int j = 0 ; j < buckets . get ( i ) . size ( ) ; j ++ ) { Job job = createJob ( status , software ) ; jobDistribution . get ( username ) . add ( job . getUuid ( ) ) ; } } return jobDistribution ; }
Creates a distribution of jobs uniformly spread across all users.
Creates a distribution of jobs uniformly spread across all users .
// generates a list of buckets with the task indices arranged in a list within each bucket