Skip to content
Snippets Groups Projects
Commit 5c1739ba authored by Danny Auble's avatar Danny Auble
Browse files

put lfts and rgts in for new sort

parent 4f37709d
No related branches found
No related tags found
No related merge requests found
...@@ -94,17 +94,15 @@ int _setup_assoc_list() ...@@ -94,17 +94,15 @@ int _setup_assoc_list()
update.type = SLURMDB_ADD_ASSOC; update.type = SLURMDB_ADD_ASSOC;
update.objects = list_create(slurmdb_destroy_association_rec); update.objects = list_create(slurmdb_destroy_association_rec);
/* Since we don't want to worry about lft and rgt's here we
* need to put the assocs in hierarchical order using push
* not append. */
/* First only add the accounts */ /* First only add the accounts */
/* root association */ /* root association */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 1; assoc->id = 1;
assoc->lft = 1;
assoc->rgt = 28;
assoc->acct = xstrdup("root"); assoc->acct = xstrdup("root");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of root id 1 */ /* sub of root id 1 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
...@@ -112,8 +110,10 @@ int _setup_assoc_list() ...@@ -112,8 +110,10 @@ int _setup_assoc_list()
assoc->id = 2; assoc->id = 2;
assoc->parent_id = 1; assoc->parent_id = 1;
assoc->shares_raw = 40; assoc->shares_raw = 40;
assoc->lft = 2;
assoc->rgt = 13;
assoc->acct = xstrdup("AccountA"); assoc->acct = xstrdup("AccountA");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountA id 2 */ /* sub of AccountA id 2 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
...@@ -121,117 +121,142 @@ int _setup_assoc_list() ...@@ -121,117 +121,142 @@ int _setup_assoc_list()
assoc->id = 21; assoc->id = 21;
assoc->parent_id = 2; assoc->parent_id = 2;
assoc->shares_raw = 30; assoc->shares_raw = 30;
assoc->lft = 3;
assoc->rgt = 6;
assoc->acct = xstrdup("AccountB"); assoc->acct = xstrdup("AccountB");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountB id 21 */ /* sub of AccountB id 21 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 211; assoc->id = 211;
assoc->lft = 4;
assoc->rgt = 5;
assoc->parent_id = 21; assoc->parent_id = 21;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 20; assoc->usage->usage_raw = 20;
assoc->acct = xstrdup("AccountB"); assoc->acct = xstrdup("AccountB");
assoc->user = xstrdup("User1"); assoc->user = xstrdup("User1");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountA id 2 */ /* sub of AccountA id 2 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 22; assoc->id = 22;
assoc->lft = 7;
assoc->rgt = 12;
assoc->parent_id = 2; assoc->parent_id = 2;
assoc->shares_raw = 10; assoc->shares_raw = 10;
assoc->acct = xstrdup("AccountC"); assoc->acct = xstrdup("AccountC");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountC id 22 */ /* sub of AccountC id 22 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 221; assoc->id = 221;
assoc->lft = 8;
assoc->rgt = 9;
assoc->parent_id = 22; assoc->parent_id = 22;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 25; assoc->usage->usage_raw = 25;
assoc->acct = xstrdup("AccountC"); assoc->acct = xstrdup("AccountC");
assoc->user = xstrdup("User2"); assoc->user = xstrdup("User2");
list_push(update.objects, assoc); list_append(update.objects, assoc);
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 222; assoc->id = 222;
assoc->lft = 10;
assoc->rgt = 11;
assoc->parent_id = 22; assoc->parent_id = 22;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 0; assoc->usage->usage_raw = 0;
assoc->acct = xstrdup("AccountC"); assoc->acct = xstrdup("AccountC");
assoc->user = xstrdup("User3"); assoc->user = xstrdup("User3");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of root id 1 */ /* sub of root id 1 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 3; assoc->id = 3;
assoc->lft = 14;
assoc->rgt = 23;
assoc->parent_id = 1; assoc->parent_id = 1;
assoc->shares_raw = 30; assoc->shares_raw = 30;
assoc->acct = xstrdup("AccountD"); assoc->acct = xstrdup("AccountD");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountD id 3 */ /* sub of AccountD id 3 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 31; assoc->id = 31;
assoc->lft = 19;
assoc->rgt = 22;
assoc->parent_id = 3; assoc->parent_id = 3;
assoc->shares_raw = 25; assoc->shares_raw = 25;
assoc->acct = xstrdup("AccountE"); assoc->acct = xstrdup("AccountE");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountE id 31 */ /* sub of AccountE id 31 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 311; assoc->id = 311;
assoc->lft = 20;
assoc->rgt = 21;
assoc->parent_id = 31; assoc->parent_id = 31;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 25; assoc->usage->usage_raw = 25;
assoc->acct = xstrdup("AccountE"); assoc->acct = xstrdup("AccountE");
assoc->user = xstrdup("User4"); assoc->user = xstrdup("User4");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountD id 3 */ /* sub of AccountD id 3 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 32; assoc->id = 32;
assoc->lft = 15;
assoc->rgt = 18;
assoc->parent_id = 3; assoc->parent_id = 3;
assoc->shares_raw = 35; assoc->shares_raw = 35;
assoc->acct = xstrdup("AccountF"); assoc->acct = xstrdup("AccountF");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountF id 32 */ /* sub of AccountF id 32 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 321; assoc->id = 321;
assoc->lft = 16;
assoc->rgt = 17;
assoc->parent_id = 32; assoc->parent_id = 32;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 0; assoc->usage->usage_raw = 0;
assoc->acct = xstrdup("AccountF"); assoc->acct = xstrdup("AccountF");
assoc->user = xstrdup("User5"); assoc->user = xstrdup("User5");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of root id 1 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 4; assoc->id = 4;
assoc->lft = 24;
assoc->rgt = 27;
assoc->parent_id = 1; assoc->parent_id = 1;
assoc->shares_raw = 30; assoc->shares_raw = 30;
assoc->acct = xstrdup("AccountG"); assoc->acct = xstrdup("AccountG");
list_push(update.objects, assoc); list_append(update.objects, assoc);
/* sub of AccountG id 4 */ /* sub of AccountG id 4 */
assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc = xmalloc(sizeof(slurmdb_association_rec_t));
assoc->usage = create_assoc_mgr_association_usage(); assoc->usage = create_assoc_mgr_association_usage();
assoc->id = 41; assoc->id = 41;
assoc->lft = 25;
assoc->rgt = 26;
assoc->parent_id = 4; assoc->parent_id = 4;
assoc->shares_raw = 1; assoc->shares_raw = 1;
assoc->usage->usage_raw = 30; assoc->usage->usage_raw = 30;
assoc->acct = xstrdup("AccountG"); assoc->acct = xstrdup("AccountG");
assoc->user = xstrdup("User6"); assoc->user = xstrdup("User6");
list_push(update.objects, assoc); list_append(update.objects, assoc);
assoc_mgr_update_assocs(&update); assoc_mgr_update_assocs(&update);
list_destroy(update.objects); list_destroy(update.objects);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment