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 --oldest and --clear features to prioritize #851

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

Conversation

ab9rf
Copy link
Member

@ab9rf ab9rf commented Oct 6, 2023

No description provided.

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

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

can i haz rst docs? also changelog?

it would be nice to be able to see what the oldest N jobs are before they are prioritized. I'm also a little unsure how to promote/explain the oldest jobs functionality so that it gets used appropriately. should we add a repeat command to the control panel that calls it once a ?

Comment on lines +206 to +207
local job = df.global.world.jobs.list
while ( job.next ) do
Copy link
Member

Choose a reason for hiding this comment

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

consider

for _,job in utils.listpairs(df.global.world.jobs.list) do

job here is link.item, and it takes care of the initial nil for you so you don't have to check for nil

@@ -479,6 +506,13 @@ end
local function parse_commandline(args)
local opts, action, unit_labors, reaction_names = {}, status, nil, nil
local positionals = argparse.processArgsGetopt(args, {
{'o', 'oldest', hasArg=true, handler=function(arg)
action = boost_oldest
opts.oldest_count = arg
Copy link
Member

Choose a reason for hiding this comment

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

I suggest using argparse.nonnegativeInt() to validate arg

local job = df.global.world.jobs.list
while ( job.next ) do
job = job.next
if (job.item and not job.item.flags.do_now and job.item.order_id == -1) then
Copy link
Member

Choose a reason for hiding this comment

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

I see this excludes manager orders. should it also exclude repeat jobs? what about jobs that already have a worker attached and are in progress?

Copy link
Member Author

Choose a reason for hiding this comment

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

it probably should preclude repeat jobs, i don't use those in my forts except very rarely so it did not come up for me

the others are also good ideas

@ab9rf
Copy link
Member Author

ab9rf commented Oct 6, 2023

it would be nice to be able to see what the oldest N jobs are before they are prioritized. I'm also a little unsure how to promote/explain the oldest jobs functionality so that it gets used appropriately. should we add a repeat command to the control panel that calls it once a ?

all of these are "maybe? dunno yet, need more experiences" to tell, i'm still experimenting with numbers to use here

a reporting tool might be a good idea, but i'm not sure how to go about that

i have a separate script that does something along these lines but it is very much not ready to be shared with the community

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