def allocate(self): consul_obj = consul.Consul(host=global_env.consul_host, token=global_env.consul_acl_token) kv = consul_obj.kv blueprint = self.blueprint host1 = allocate.allocate(blueprint['memsize']) host2 = allocate.allocate(blueprint['memsize'], anti_affinity=[host1]) kv.put('tarantool/%s/allocation/instances/1/host' % self.group_id, host1) kv.put('tarantool/%s/allocation/instances/2/host' % self.group_id, host2)
def allocate(self): consul_obj = consul.Consul(host=global_env.consul_host, token=global_env.consul_acl_token) kv = consul_obj.kv blueprint = self.blueprint host = allocate.allocate(blueprint['memsize']) kv.put('tarantool/%s/allocation/instances/1/host' % self.group_id, host)
"BookingId": [part + "-" + str(i) for i in range(0, order_days)], "Priority": 100, "Part": part, "Quantity": pd.Series(nd.random.poisson(lam=lam, size=order_days)), "DueDate": pd.date_range(start="2018-01-15", periods=order_days) }) for (part, lam) in order_rates ]) prev_parts = [] fig, ax = plt.subplots() for label, df in bookings.groupby("Part"): df.plot(ax=ax, x="DueDate", y="Quantity", label=label) plt.show() # %% results, simstat, simprod = allocate.allocate( bookings=bookings, prev_parts=prev_parts, flex_file="sample-flex.json", plugin="../../orderlink/lib/pegboard/allocate") allocate.print_result_summary(results) allocate.plot_simprod(results) allocate.plot_simstat(simstat) # %% allocate.download(results, "localhost:5000")
for key, value in lecturercaps.items(): sumcaps += value if int(sumcaps) < (len(medinit_unassignedStudents) + len(nonmedinit_unassignedStudents)): sys.exit("Not enough capacity between all lecturers: only " + str(sumcaps) + " lecturer slots available for " + str((len(medinit_unassignedStudents) + len(nonmedinit_unassignedStudents))) + " students. Check input files.") # Run the main allocation function # MedChem if randomise: random.shuffle(medinit_unassignedStudents) medallocation = allocate.allocate(med_studPrefs, medinit_unassignedStudents, lectPrefs, projLects, lectProjs, lecturercaps, projCaps, randomise, updates, iterationLimit) med_studAssignments = medallocation["Student Assignments"] med_lectAssignments = medallocation["Lecturer Assignments"] med_projAssignments = medallocation["Project Assignments"] med_unassignedStudents = medallocation["Unassigned Students"] # Remove any assigned medicinal topics from the preference lists of any non-med chem student for key, value in nonmed_studPrefs.items(): for project in value: if project in med_studAssignments: value.remove(project) if randomise: random.shuffle(nonmedinit_unassignedStudents) # Non Med-Chem
n = 5 # liczba wezłów temp = n nodes, elements = generate(x_0,x_p,n) # warunki brzegowe wb = [{"index": 1, "type": 'D', "value": 1}, {"index": n, "type": 'D', "value": 2}] else: print("\nYou entered a wrong number!\nApplying option 1") # definicja nodes, elements, wb = define() plot(nodes,elements,wb) A, b = allocate(temp) baseFunDegree = 1 phi, dphi = base(baseFunDegree) # Processing elementsCount = np.shape(elements)[0] for ee in np.arange(0, elementsCount): elemRowInd = ee elemGlobalInd = elements[ee,0] elemNode1 = elements[ee,1] # indeks węzła początkowego elementu ee elemNode2 = elements[ee,2] # indeks węzła końcowego elementu ee indGlobalNode = np.array([elemNode1, elemNode2])