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

Refs #10755 - Recurring actions, job invocation task groups #44

Merged
merged 1 commit into from Dec 2, 2015

Conversation

adamruzicka
Copy link
Contributor

@theforeman-bot
Copy link
Member

@adamruzicka, this pull request is currently not mergeable. Please rebase against the master branch and push again.

If you have a remote called 'upstream' that points to this repository, you can do this by running:

    $ git pull --rebase upstream master

This message was auto-generated by Foreman's prprocessor

@ares
Copy link
Member

ares commented Oct 5, 2015

request for rebase :-)

@@ -31,6 +31,11 @@ def create
ForemanTasks.delay action,
job_invocation.delay_options,
job_invocation
elsif job_invocation.trigger_mode == :recurring
Copy link
Member

Choose a reason for hiding this comment

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

case job_invocation.trigger_mode might work better than if/elsif here

@theforeman-bot
Copy link
Member

@adamruzicka, this pull request is currently not mergeable. Please rebase against the master branch and push again.

If you have a remote called 'upstream' that points to this repository, you can do this by running:

    $ git pull --rebase upstream master

This message was auto-generated by Foreman's prprocessor

@iNecas
Copy link
Member

iNecas commented Oct 21, 2015

Did another set of testing, the new version, with middleware works much intuitively.


def delay(delay_options, job_invocation)
def delay(delay_options, job_invocation, locked = false)
task.add_missing_task_groups(job_invocation.task_group)
Copy link
Member

Choose a reason for hiding this comment

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

Currently, the iterations after the first one don't have their own job invocation instance, so that the events are not shown in job invocations index, so we then can't track status from the job perspective then. We should check here, and in case the job has already a task, we should clone the invocation, rather than use the current one.

Also, since we're mapping the job invocation to 0-1 tasks, we should rename 'last_task_id', to just 'task_id'.

@iNecas
Copy link
Member

iNecas commented Oct 21, 2015

It should be nice, to be able to get to the recurring logic details, where one would be able to get to the next jobs of belonging the the recurring logic group etc.

@ares
Copy link
Member

ares commented Oct 27, 2015

This needs rebase :-(

@adamruzicka
Copy link
Contributor Author

@iNecas all the comments should be addressed

@iNecas
Copy link
Member

iNecas commented Nov 20, 2015

When using hourly recurring option, I'm getting:

invalid strptime format - `%Y-%m-%d %H:%M'
Rails.root: /home/inecas/Projects/ws/foreman-rex/foreman

/home/inecas/Projects/ws/foreman-rex/foreman-tasks/app/models/foreman_tasks/triggering.rb:78:in `parse_start_at!'
/home/inecas/Projects/ws/foreman-rex/foreman-tasks/app/models/foreman_tasks/triggering.rb:9:in `block in <class:Triggering>'
/home/inecas/Projects/ws/foreman-rex/foreman_remote_execution/app/models/job_invocation_composer.rb:45:in `save'
/home/inecas/Projects/ws/foreman-rex/foreman_remote_execution/app/controllers/job_invocations_controller.rb:31:in `create'
app/controllers/concerns/application_shared.rb:13:in `set_timezone'
app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Debugging showed that the start_at_raw was empty.

@@ -0,0 +1,9 @@
class AddJobInvocationTaskGroup < ActiveRecord::Migration
def up
add_column :job_invocations, :task_group_id, :integer, :index => true
Copy link
Member

Choose a reason for hiding this comment

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

Foreign key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Should I add the database constraint or can we allow a job invocation to have no task group?

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK you can have foreign key on nullable fields - it should check the contraint just on the case, when the field is entered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I'll add the constraints

@adamruzicka
Copy link
Contributor Author

Should be fixed in adamruzicka/foreman-tasks@20cf8ea

@@ -0,0 +1,9 @@
class AddTriggeringToJobInvocation < ActiveRecord::Migration
def up
add_column :job_invocations, :triggering_id, :integer, :index => true
Copy link
Member

Choose a reason for hiding this comment

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

Foreign key again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, yes. A job invocation could be created without a triggering so it made sense to me not to enforce the association

@iNecas
Copy link
Member

iNecas commented Nov 23, 2015

Looks better every iteration: from the last testing (some comments might apply to the foreman-tasks PR):

  • future execution doesn't have a default values set - this was quite useful to have set to current time, instead of having to write the time on my own, I would welcome having that back
  • related resources in the job invocation seems strange (in the recurring logics it might have some sense, although even there, it would be nice just to be able to link to the job invocation detail), having 'Recurring logic' tab there would be better IMO
  • canceling the recurring logic leads to 'Template missing' error message
  • Finished: running seems strange, status might be better, also, I would perhaps choose Active over Running, as the Running might feel the task actually running at the moment and is a bit misleading

@adamruzicka
Copy link
Contributor Author

  • future execution doesn't have a default values set - this was quite useful to have set to current time, instead of having to write the time on my own, I would welcome having that back
  • canceling the recurring logic leads to 'Template missing' error message
  • Finished: running seems strange, status might be better, also, I would perhaps choose Active over Running, as the Running might feel the task actually running at the moment and is a bit misleading

addressed in adamruzicka/foreman-tasks@8ee423e

  • related resources in the job invocation seems strange (in the recurring logics it might have some sense, although even there, it would be nice just to be able to link to the job invocation detail), having 'Recurring logic' tab there would be better IMO

In recurring logic details

Shows type of the resource and count per type, links to job invocations index filtered by the recurring logic id
in recurring logic

In job invocation details

Should this show the resources related to the recurring logic too?
in job invocation

@iNecas
Copy link
Member

iNecas commented Nov 26, 2015

The default time for future execution works for new invocations, but still missing when using the re-run. Minor, but still nice to have enhancement.

@iNecas
Copy link
Member

iNecas commented Nov 27, 2015

Waiting for theforeman/foreman-tasks#141 to get released

@adamruzicka adamruzicka force-pushed the recurring branch 2 times, most recently from 1bf6411 to 1e56517 Compare December 1, 2015 12:09
@iNecas
Copy link
Member

iNecas commented Dec 1, 2015

Waiting for rubocop and squash

@iNecas
Copy link
Member

iNecas commented Dec 2, 2015

No other reasons for not getting this into master. Merging now. Thanks @adamruzicka

iNecas added a commit that referenced this pull request Dec 2, 2015
Refs #10755 - Recurring actions, job invocation task groups
@iNecas iNecas merged commit 03807a0 into theforeman:master Dec 2, 2015
@adamruzicka adamruzicka deleted the recurring branch December 2, 2015 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants