Commit Graph

30 Commits (99cfbfe8cf8f1c857c888aa633cc656507955c8b)

Author SHA1 Message Date
Sam Arnold 7b2e122869
refactor: refactor for tasks backport (#21117)
* chore: remove dead code

* refactor: move FluxLanguageService interface to fluxlang

* chore: run fmt

* refactor: move task.go from top level to task/taskmodel

* chore: run formatter

* chore: fix up import ordering with gci
2021-04-07 14:42:55 -04:00
Daniel Moran 00afd95cb7
refactor: automated move of errors and id from root to kit (#21101)
Co-authored-by: Sam Arnold <sarnold@influxdata.com>
2021-03-30 14:10:02 -04:00
Daniel Moran e86ee475b2
fix: make AST-based option parsing the default, remove feature flag (#20875) 2021-03-08 09:51:21 -05:00
George MacRorie 16d916a952 refactor(kv): delete deprecated kv service code
This includes removal of a lot of kv.Service responsibilities. However,
it does not finish the re-wiring. It removes documents, telegrafs,
notification rules + endpoints, checks, orgs, users, buckets, passwords,
urms, labels and authorizations. There are some oustanding pieces that
are needed to get kv service compiling (dashboard service urm
dependency). Then all the call sites for kv service need updating and
the new implementations of telegraf and notification rules + endpoints
needed installing (along with any necessary migrations).
2020-11-16 12:41:26 +00:00
Adrian Thurston 30ad7281aa
refactor: replace builtin package with fluxinit/static (#3304) (#19909)
A static initialization is not desirable in the main binaries, as it forces all
paths of code to init, but it is still useful in tests. It allows static
intialization to be performed once for all tests and eliminates the need to
always add the FluxInit call. Added a fluxinit/static package that calls
fluxinit.FluxInit() to replace the builtin package. This hides the nature of
the initialization and makes it clear that it is mandatory initialization code
getting called.
2020-11-05 16:54:28 -08:00
Lyon Hill a8fe07bfc7
chore(task): clean up old maxPermission code (#19432)
Tasks no longer uses the max permission system to pupulate an
authorization. We can safely remove this dead code.
2020-08-26 10:26:32 -06:00
Brett Buddin f96303bfb2
feat(task): Record last success and failure run times in the Task (#19390)
* feat(task): Record the latest success/failure of a Task.

* chore(task): Fix typo.

* chore(kv): Test the updating of latest success/failure fields.

* fix(kv/task): Copy the latest success/failure fields when unmarshalling.

* chore(changelog): Add 19390 to changelog.
2020-08-25 10:44:37 -04:00
Lyon Hill 0a9e8fdb4a
chore: update task tests to use the tenant service (#19169)
* chore: update task tests to use the tenant service

After the introduction of the tenant system we need to switch the testing frameworks
to use it instead of the old kv system

* chore: update onboarding to allow injected middleware
2020-08-03 09:33:46 -06:00
George 96d84b9126
refactor: migrator and introduce Store.(Create|Delete)Bucket (#18570)
* refactor: migrator and introduce Store.(Create|Delete)Bucket

feat: kvmigration internal utility to create / managing kv store migrations

fix: ensure migrations applied in all test cases

* chore: update kv and migration documentation
2020-07-01 12:08:20 +01:00
Brett Buddin 81e4b02b42
fix(kv): Install feature-flag for switching between normal and simplified options parsing. (#18662) 2020-06-23 12:22:53 -04:00
Lyon Hill c9177b8913
feat: migrate task records to always have an owner id (#18513)
* feat: migrate task records to always have an owner id

Co-authored-by: Alirie Gray <alirie.gray@gmail.com>
Co-authored-by: George <me@georgemac.com>
2020-06-17 12:30:37 -06:00
Lyon Hill 4809285c91
fix: remove urm create from task create request. (#18519)
* fix: remove urm create from task create request.

This will greatly reduce the amount of urms created in the system. To make this change to the system we need to also remove our direct reliance on the urm's in tasks.
Remove the create and delete portion of the task actions that are creating and deleting urms
Remove reliance on urm's when we are doing FindTaskByUser and instead rely on the user filter matching the task.OwnerID

One test had to be changed because the test was explicitly hacking the task to remove the owner ID and then trying to successfully look up the task by ownerID

* fix: add in feature flag

* fix: apply cursor cleanliness and permission error handling
2020-06-17 08:20:05 -06:00
Jonathan A. Sternberg d3fa60991f
Merge branch 'master' into chore/merge-master 2020-04-06 12:17:47 -05:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Jonathan A. Sternberg 0d6e4e310b
Merge branch 'master' into feat/use-algo-w 2020-03-06 16:46:49 -06:00
Jonathan A. Sternberg 834a8740e0
refactor(task/backend): move the task/backend constants to the global package (#17133)
This moves a few types and constants to the global package so it can be
used without importing the `task/backend` package. These constants are
referenced in non tasks-specific code.

This is needed to break a dependency chain where the task backend will
call into the flux runtime to perform parsing or evaluation of a script
and to prevent the http package from inheriting that dependency.
2020-03-06 16:19:32 -06:00
Jonathan A. Sternberg bcbb9df72e
refactor(task): tasks will now use the flux language service (#17104)
The tasks subsystem will now use the flux language service to parse and
evaluate flux instead of directly interacting with the parser or
runtime. This helps break the dependency on the libflux parser for the
base influxdb package.

This includes the task notification packages which were changed at the
same time.
2020-03-05 14:36:58 -06:00
Alirie Gray 6c6bd39ffc
refactor(tasks): remove dead scheduler code (#16252) 2020-01-02 11:41:21 -08:00
Johnny Steenbergen fb325fbc10 chore(kv): drop duplicative tests 2019-12-30 16:27:36 -08:00
Brett Buddin a2de2cc5c8
fix(kv): Store canceled task runs in the correct bucket.
Task runs are stored and retrieved from the `taskRunsv1` bucket, but
when they are canceled they are incorrectly placed in the `tasksv1`
bucket. Once this has been done, further look ups of the task run fail,
because it is located in the wrong bucket.

This addresses the problem by placing them back into the `taskRunsv1`
bucket. An additional test has been added to ensure we are able to
successfully read a canceled run.
2019-12-17 10:19:27 -05:00
Stuart Carnie 2640f87538
fix(task): LatestScheduled is set when task is updated to active
This change ensures the following behavior:

* task LatestScheduled is always set when a task is updated and
  transitions from a status of inactive to active
* task LatestScheduled is non-zero when created, to set the initial
  schedule time as some point after it was created

In addition, the kv.Service introduces clock.Clock that is used for
task create and task updates only. This change permits testing
in a deterministic fashion.
2019-12-06 11:52:54 -07:00
Jacob Marble 5f19c6cace
chore: Remove several instances of WithLogger (#15996)
* chore: Remove several instances of WithLogger

* chore: unexport Logger fields

* chore: unexport some more Logger fields

* chore: go fmt

chore: fix test

chore: s/logger/log

chore: fix test

chore: revert http.Handler.Handler constructor initialization

* refactor: integrate review feedback, fix all test nop loggers

* refactor: capitalize all log messages

* refactor: rename two logger to log
2019-12-04 15:10:23 -08:00
Alirie Gray 9417936069
feat(tasks): add ability to filter by active tasks (#15893) 2019-12-02 14:16:10 -08:00
Alirie Gray f0ecc0e89d
refactor(tasks): use go Time for Task CreatedAt, UpdatedAt, LatestCompleted, Offset (#15672) 2019-11-12 17:13:56 -08:00
Lyon Hill 270d39224c
fix(task): include offset in next due calculation (#15281) 2019-09-25 15:21:37 -06:00
Lyon Hill cce5ed74ea
fix(task): fix failover function for task auth to not fail (#14789)
If a task is created and the auth associated is removed
lookup of tasks currently fail. This is bad behavior.
We should expect to be able to at least see and delete task's that
have old auth.
2019-08-23 16:52:55 -06:00
Lyon Hill a8d7870689
feat(task): impersonate user on task execution (#14675)
* feat(task): impersonate user on task execution

Passing tokens to tasks is cumbersome and we needed a way to more easily create tasks. With this change we no longer need a token on task create. We take the user that created the task and pass that in as the "owner". As far as the task is concerned the owner is the source of permissions.

This is done by adding an additional field on task create that is OwnerID. We will no longer respect the token passed in and it will be deprecated soon.

Things to do still:
Task updates need to allow for owners to be set.
2019-08-15 18:31:52 -06:00
Lyon Hill f4fb6a1753
fix(task): Unify task scheduling across create and query (#14668)
Current behavior is that the first execution of a task happens based on the create time
of the task when using a 'every' schedule. If you create a task at 12:02 and want
the task to run every 15m. The first execution would happen at 12:17, and the 2nd would happen
at 12:30.

To fix this behavior I refactored the kv task to give a single source of knowledge.
We now have one function for finding exactly what the last scheduled task was.
We also now have a single method that calculates when the next schedule is due.
By unifying the logic it should always work the same way weather your asking when to run
or when creating a task.
2019-08-15 15:28:35 -06:00
Lyon Hill 9a41cc46e4
Create an analytical storage middleware layer (#13418)
* Create an analytical storage middleware layer
2019-04-17 08:41:05 -06:00
Lyon Hill c29e77e6e4
build kv based TaskService (#13228)
* chore(tasks): task kv

* WIP

* get the kv task service complete and passing test
2019-04-09 16:52:54 -06:00