Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for inequal distributions of workload #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RensAlthuis
Copy link

Hi, I'm currently working as a TA for functional programming for AI.
We had an issue that one of the TAs should have a higher workload than the others.
Our quick fix was of course to add the TAs multiple times which is very annoying because everyone would get multiple emails etc.

Anyway long story short, I made some changes to introduce an (optional) distribution array which allows the script to partition the work. It works perfectly in my tests but I haven't done much bash scripting before so it might have some bugs that I missed.

Hope it's something you guys approve of

@squell squell requested a review from dopefishh January 8, 2020 12:41
@dopefishh
Copy link
Collaborator

I've been busy and will check this next week.

Copy link
Collaborator

@dopefishh dopefishh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply.
I'm fine with the changes but the MR contains many unrelated changes that need to go before merging

@@ -1,28 +1,52 @@
#! /bin/bash

# partition ALL SUBDIRECTORIES in equal parts into the folders given as arguments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated line gone

echo "dir: $1"
shift
echo "val: $1"
distribution[$((i++%N))]=$(echo "$1*$numFolders" | bc | mawk '{print int($1+0.5)}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really need mawk? or can bc or any awk do this?

until [ -z "$1" ]; do
# temporarily hide the folders we are sorting into
test -d "$1" && mv "$1" ".$1"
mkdir -p ".$1"
dir[$((i++%N))]="$1"
dir[$((i%N))]="$1"
echo "dir: $1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these prints necessary

@@ -1,6 +1,6 @@
#! /bin/bash

# TODO:
# TODO:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary change

email[marc]="[email protected]"
#email[ko]="[email protected]"
#email[pol]="[email protected]"
typeset -A distribution
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep using the marc/ko/pol example graders, they deserve it:')

@@ -120,7 +123,7 @@ if [ "$CSV" ]; then
"$MYDIR"/identify.sh "$CSV" */
fi

echo
echo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

@@ -186,8 +208,8 @@ do
echo Mailing "$ta"
pkt="$ta-${zip%.zip}.7z"
7za a -ms=on -mx=9 "$pkt" "$ta" > /dev/null
#echo "$humor" | mailx -n -s "${SUBJECT} ${zip%.zip}" -a "$pkt" "${email[$ta]}"
echo "$humor" | mutt -s "${SUBJECT}: ${zip%.zip}" -a "$pkt" -- "${email[$ta]}"
#echo "$humor" | mailx -n -s "${SUBJECT} ${zip%.zip}" -a "$pkt" "${email[$ta]}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

@RensAlthuis
Copy link
Author

Oh yeah, thats my bad.
I made these changes just for our purposes. I didn't put in the time to clean up the pull request. This was more of a: "Hey, is this something you'd want?" kind of thing. When I have time, I can clean up the random edits and make it in to a proper pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants