Commit Graph

498 Commits (master)

Author SHA1 Message Date
Brett Buddin 1ae2541bf3
feat(task): Inject Task's LatestSuccess Timestamp In Flux Extern (#19402)
* feat(task): Inject latest success/failure into extern.

* chore(task/backend): Don't specify an extern if there are no statements.

* chore(task/executor): Don't apply the latest failure for now.

* chore(changelog): Add 19402 to changelog.

* chore(kit): Introduce feature flag for time injection.

* chore(task/executor): Guard injection into extern by feature flag.

* chore(task/executor): No need for this subtest pattern.

* chore(task/executor): Add tests for extern injection.
2020-08-25 13:06:26 -04:00
Paul Hummer 342a29897e
Merge pull request #19427 from influxdata/flux-staging/v0.82.2
build(flux): update Flux to v0.82.2
2020-08-25 11:03:52 -06:00
Stuart Carnie 0e0b2a3d87
Merge remote-tracking branch 'origin/master' into sgc/tsm1 2020-08-25 09:03:07 -07:00
Lyon Hill f0e382adc2
chore: remove feature flag for task executor (#19422)
We now default task execution to pull from the user service a permission
set.
2020-08-25 08:39:03 -06:00
Paul Hummer df41d42457 build(flux): update Flux to v0.82.2 2020-08-25 08:04:28 -06:00
Stuart Carnie 7c972387e2
chore(task): Flux compatibility fixes
This commit temporarily pulls in code from the flux/ast/edit
package ensure builds continue. Once Flux is upgraded to the
latest, the pkg/flux package will be removed.
2020-08-20 11:25:51 -07:00
Stuart Carnie cc656e5221
Merge remote-tracking branch 'origin/master' into sgc/tsm1
# Conflicts:
#	storage/reads/aggregate_resultset.go
#	storage/reads/aggregate_resultset_test.go
#	storage/reads/array_cursor.gen.go
#	storage/reads/array_cursor.gen.go.tmpl
#	storage/reads/array_cursor.go
#	storage/reads/array_cursor_gen_test.go
#	storage/reads/array_cursor_test.gen.go.tmpl
#	storage/reads/group_resultset.go
#	storage/reads/group_resultset_test.go
#	storage/reads/resultset.go
2020-08-20 10:52:34 -07:00
Brett Buddin 0780232b83
feat(task): Parse Task Options using Flux AST Helpers (#19326)
* feat(task): Extract options using AST-based method.

* feat(task): Use AST-based option APIs for updating task option.

* chore(task): Use the old way of parsing durations.

* fix(task): Ordering changed on us. Fixing tests to reflect the new order.

* fix(task): There's no way for us to know if there are multiples with the current APIs.

* chore(task): Guard against duplicate options. Minor cleanup.

* fix(kit/feature): Break cyclical dependency between influxdb and pkgs that use feature.

* chore(task): Feature flag updating Flux options.

* chore(task): Ensure we are testing both paths of feature flag.

* chore: Remove dead code.

* chore(task/options): Remove unnecessary conditional.

* chore(task/options): Unexport some error helpers.
2020-08-20 11:57:23 -04:00
Stuart Carnie f47bab1f0d
fix(task): Configure meta.Client to allow tests to pass 2020-08-03 15:13:47 -07:00
Stuart Carnie 533b5c4ed6
fix: Build error 2020-08-03 09:20:51 -07:00
Stuart Carnie 26c18ac0a5
chore: Converging on 1.x tsdb 2020-08-03 09:20:48 -07:00
Edd Robinson 2b175291be
refactor: WIP removing tsbd 2020-08-03 09:18:34 -07:00
Stuart Carnie a97ec1f34e
feat: Initial commit with working reads 2020-08-03 09:18:34 -07:00
Stuart Carnie e3060c291c
refactor: tsdb store builds an runs 2020-08-03 09:18:32 -07: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
Lyon Hill a31b651057
feat(task): Add new permission lookup pattern for executor (#18920)
* feat(task): Add new permission lookup pattern for executor

We can now use the user service to populate task owners permissions.
This should improve the task lookup time and decouple the task system
from the URM system. In the future we will have the ability to better isolate
tenant pieces from the rest of the service.

* feat: add feature flagging
2020-07-13 14:47:58 -06:00
George b8f5604613
revert(tasks): Add new permission lookup pattern for executor (#18869) (#18915)
This reverts commit e9e4d794cf.
2020-07-10 11:05:07 +01:00
Lyon Hill e9e4d794cf
feat(task): Add new permission lookup pattern for executor (#18869)
We can now use the user service to populate task owners permissions.
This should improve the task lookup time and decouple the task system
from the URM system. In the future we will have the ability to better isolate
tenant pieces from the rest of the service.
2020-07-09 14:06: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
Jonathan A. Sternberg 5aeca082c8
chore: update staticcheck and fix newly identified lint checks (#18737) 2020-06-26 18:54:09 -05:00
Johnny Steenbergen 3c14db1c77 fix(influx): support days as duration type
closes: #18639
2020-06-22 20:07:53 -07:00
Brett Buddin 0f4b0fbe68
fix(task/executor): Don't send Now for Flux compiler. See TODO for details. 2020-06-18 15:27:28 -04:00
Lyon Hill 22c573df68
fix: clean up old runs when we fail to enqueue it (#18482)
* fix: clean up old runs when we fail to enqueue it

We need to make sure the runs are removed if we fail to enqueue the run to be worked.
for this we will now add an error message stating why we failed and move the run out of our kv store.

* fix: update fail message
2020-06-12 13:02:31 -06:00
Brett Buddin 9b53315e33
feat(task): Separate System from Non-System query compiler feature flagging. 2020-06-08 15:04:13 -04:00
Jonathan A. Sternberg 0c8d19e896
Merge branch 'master' into feat/use-algo-w 2020-05-18 13:25:26 -05:00
Brett Buddin f59c2ce009
feat(task): Allow switching of compiler from outside Executor. 2020-05-14 14:22:43 -04:00
jlapacik 34e581ca0a Merge branch 'master' into chore/merge-master 2020-05-12 11:18:25 -07:00
Lyon Hill bdc882f6ce
feat(session): Build out a new session service (#17950)
This new session service has the ability to work independant of other systems
it relies on having its own store type which should allow us to be more flexible
then using the built in kv system.

I have included an in mem session store.
2020-05-11 15:04:11 -06:00
jlapacik 7541af8414 chore: merge master into algow 2020-04-15 14:42:03 -07:00
Brett Buddin c08486ba5a
feat(task): Add option to Executor to set maximum worker count. 2020-04-09 09:37:17 -04: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
George 2840e6f26e
feat(kv): add ability to configure a max permissions using auth filter function (#17598) 2020-04-03 17:02:51 +01:00
Jonathan A. Sternberg 469c5849c4
Merge branch 'master' into feat/use-algo-w 2020-04-03 09:30:04 -05:00
Gavin Cabbage b5c24f3c9d
refactor(tasks): auth user id (#17562) 2020-04-02 09:40:00 -04:00
Brett Buddin 3d826d96cf
feat(influxd): flag to disable scheduling of tasks 2020-03-27 12:52:07 -04:00
Brett Buddin 79cade52a6
fix(task/scheduler): Reuse slices built by iterator to reduce allocations. 2020-03-24 10:14:02 -04:00
Christopher M. Wolff 20c2439230
refactor(http): change *ast.Package to json.RawMessage in query requests (#17316) 2020-03-23 12:39:24 -07:00
Sebastian Borza 42856e1394
chore(storageflux): fix linter issue 2020-03-10 17:54:06 -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
Jonathan A. Sternberg 935180e9bd
refactor: update flux for the runtime package (#17002) 2020-02-27 11:31:45 -06:00
George bc64968b0b
chore(task): add test around paging using after (#16774)
* chore(task): add test around paging using after

* fix(kv): support filter.After in FindTasksByUser
2020-02-07 15:48:55 +00:00
docmerlin (j. Emrys Landivar) 06102ba3d4 fix(tasks): reduce memory allocations in scheduler
This will reduce memory allocations in the scheduler by removing
unneccessary delete/replace actions on the btree that is used as an
internal priority queue.
2020-02-07 09:30:50 -06:00
Christopher M. Wolff 0f3aabc954
refactor(query): let influxdb build against algo-w branch (#16673) 2020-01-24 14:36:09 -08:00
docmerlin (j. Emrys Landivar) faa87485bd fix(tasks): use LatestCompleted if LatestScheduled is behind 2020-01-17 13:15:13 -06:00
Lorenzo Affetti 0e0b36be0c feat(task): make task query without returning content 2020-01-17 16:51:01 +01:00
j. Emrys Landivar (docmerlin) fb2080f223 feat(tasks): enable full flux durations for every and offset options 2020-01-06 15:42:01 -06:00
Alirie Gray 6c6bd39ffc
refactor(tasks): remove dead scheduler code (#16252) 2020-01-02 11:41:21 -08:00
George ff38420558
feat(tasks): remove flux stats from run log and replace with trace id (#16263)
* feat(tasks): trace id in task run logs

* refactor(tracing): move trace info utility into kit/tracing package
2019-12-18 16:30:38 +01:00
Alirie Gray fc9df92d52
fix(tasks): fix flaky run latency metric test (#16236) 2019-12-16 18:59:54 -08:00
docmerlin (j. Emrys Landivar) bf88cd7502 chore(tasks): add test for task alignment 2019-12-12 13:26:59 -06:00
Bucky Schwarz bc3bfbc61e test: skip flaky cypress test 2019-12-12 13:26:59 -06:00
docmerlin (j. Emrys Landivar) 07345a58f4 fix(tasks): align @every schedule firings 2019-12-12 13:26:59 -06:00
Alirie Gray b5ccad3c07
feat(metrics): add run latency to executor metrics (#16190) 2019-12-11 14:50:32 -08: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
George 3dbb9c0fd2
feat(tracing): dont trace spans with full request paths as operation name in ExtractFromHTTPRequest (#15971)
* feat(tracing): dont trace spans with full URL path names in ExtractFromHTTPRequest

* chore(multiple): replace all occurrences of julienschmidt/httprouter with influxdata/httprouter
2019-11-25 15:22:19 +01:00
Edd Robinson c493713d90 fix(tasks): ensure field is 64-bit aligned 2019-11-22 13:25:48 +00:00
George dcfd0688af
revert(tasks): construct permissions for finish run to write to system buckets (#15986) (#16008) 2019-11-22 11:29:20 +01:00
George da647589c4
fix(tasks): construct permissions for finish run to write to system buckets (#15986) 2019-11-21 10:38:20 +01:00
Lyon Hill 5c7787743e
fix(task): add hinting to allow us to skip task auth lookup (#15973) 2019-11-19 11:06:04 -07:00
Jade McGough 6b19ea7569
fix(kv): don't stub system buckets when searching by name (#15928)
* Removed an unused function as cleanup.
* Users without true system buckets won't have fake buckets returned if they don't specify their org in the request, but this shouldn't break tasks.
2019-11-18 23:33:15 -08:00
Lyon Hill 698200b188
fix(task): make calls to update runs force UTC time (#15945)
It is best to standardize the data we store in etcd and influxdb
2019-11-15 19:36:07 -07:00
Alirie Gray f0ecc0e89d
refactor(tasks): use go Time for Task CreatedAt, UpdatedAt, LatestCompleted, Offset (#15672) 2019-11-12 17:13:56 -08:00
docmerlin (j. Emrys Landivar) 56d406afe8 fix(tasks): fix every parsing 2019-11-12 14:46:19 -06:00
Lyon Hill 7421836a1e
fix(task): add error handling for when a `FinishRun` fails (#15845) 2019-11-11 13:52:04 -07:00
Gavin Cabbage 3e29464d4b fix(tasks): fake flux deps 2019-11-08 09:35:20 -05:00
Lyon Hill bb6aa1df3b
feat(task): Add a latestScheduled field for tasks (#15785)
Previously we overwrote the tasks existing latestCompleted to be used for latestCompleted as well as latestScheduled.
For obvious reasons this is confusing and missleading. I believe by seperating the two fields we can have a clear seperation
of concerns.
2019-11-06 15:10:52 -07:00
Lyon Hill d4494273e1
fix(task): Use existing scheduler metrics (#15765) 2019-11-05 10:36:45 -07:00
Lyon Hill 3eacf77bea
fix(task): Set a valid start time for run duration (#15750)
When using a run duration we need a start time that is valid to
obtain a accurate run duration delta
2019-11-04 17:27:44 -07:00
Stuart Carnie b1875d2def
feat(kv): Cursor API accepts hints for improving performance
Implementations of the `kv.Bucket#Cursor` API may use
the hints to instruct the access or read behavior to
the underlying key/value store.

The `findAllTasks` function was also fixed to ensure
that paging works as expected when using a name filter.
Tests were added to verify this behavior.

Redundant error checks were also removed.
2019-11-01 14:48:50 -07:00
docmerlin (j. Emrys Landivar) 71a2590fba fix(tasks): scheduler btree panic 2019-11-01 10:49:47 -05:00
George bb40ca35b8
fix(tasks): thread auth on context when calling FinishRun (#15685) 2019-11-01 10:52:35 +00:00
Gavin Cabbage c60f7dbe6f Revert "fix(flux): use flux.EvalOptions over problematic flux.EvalAST"
This reverts commit d1a0ab85f7.
2019-10-31 16:04:41 -04:00
Gavin Cabbage d1a0ab85f7 fix(flux): use flux.EvalOptions over problematic flux.EvalAST 2019-10-31 12:58:41 -04:00
George 0dde41f895
fix(tasks): wire auth context down to scheduler runner (#15675) 2019-10-31 15:47:12 +00:00
Gavin Cabbage 75147d014c
feat(tasks): expose lastRunStatus and lastRunError in task API 2019-10-30 14:00:22 -04:00
docmerlin (j. Emrys Landivar) 6feae8f3ce feat(tasks): fixes for changeover 2019-10-29 10:36:47 -05:00
docmerlin (j. Emrys Landivar) aa5b094c8d refactor(task): feature flag for nw scheduler 2019-10-29 10:36:47 -05:00
Brandon Farmer bad4751709 fix(influxdb): authorizing system buckets 2019-10-21 15:49:10 -07:00
Brandon Farmer ea82dc3470 fix(tasks): tasks look up system bucket id 2019-10-21 14:48:47 -07:00
Alirie Gray 552168d3ae
refactor(tasks): use Go time objects for timestamps on task Runs (#15406) 2019-10-17 17:23:45 -07:00
George 975289fba1
refactor(tasks): separate run recording behaviour out from analytical storage (#15412) 2019-10-17 10:37:03 +01:00
Alirie Gray f096605327
fix(tasks): replace deactivation of unrecoverable errors with metric (#15430) 2019-10-16 16:00:58 -07:00
Jonathan A. Sternberg b73870d3ed
test(tasks): skip flaky test in the scheduler 2019-10-15 09:18:41 -05:00
docmerlin (j. Emrys Landivar) 0958c26382 feat(tasks): add scheduler release test 2019-10-14 14:02:25 -05:00
docmerlin (j. Emrys Landivar) b8b8422384 feat(tasks): update new scheduler in response to pr comments 2019-10-14 14:02:25 -05:00
docmerlin (j. Emrys Landivar) 4b732acb3b feat(tasks): switch the new scheduler to use clock instead of custom time mocker 2019-10-14 14:02:25 -05:00
j. Emrys Landivar (docmerlin) 3fd94cbb69 feat(task): new scheduler now with more tests 2019-10-14 14:02:25 -05:00
Lyon Hill 84bc9a8293 feat(task): add scheduler metrics (first pass) 2019-10-14 14:02:25 -05:00
j. Emrys Landivar (docmerlin) 4695eccda5 feat(tasks): new tree-based scheduler 2019-10-14 14:02:25 -05:00
Lyon Hill 3c6779f011
feat(task): Allow tasks to run more isolated from other task systems (#15384)
* feat(task): Allow tasks to run more isolated from other task systems

To allow the task internal system to be used for user created tasks as well
as checks, notification and other future additions we needed to take 2 actions:

1 - We need to use type as a first class citizen, meaning that task's have a type
and each system that will be creating tasks will set the task type through the api.
This is a change to the previous assumption that any user could set task types. This change
will allow us to have other service's white label the task service for their own purposes and not
have to worry about colissions between the types.

2 - We needed to allow other systems to add data specific to the problem they are trying to solve.
For this purpose adding a `metadata` field to the internal task system which should allow other systems to
use the task service.

These changes will allow us in the future to allow for the current check's and notifications implementations
to create a task with meta data instead of creating a check object and a task object in the database.
By allowing this new behavior checks, notifications, and user task's can all follow the same pattern:

Field an api request in a system specific http endpoint, use a small translation to the `TaskService` function call,
translate the results to what the api expects for this system, and return results.

* fix(task): undo additional check for ownerID because check is not ready
2019-10-11 08:53:38 -06:00
Alirie Gray 364e80bc94
fix(tasks): use go errors for scheduler metrics (#15374) 2019-10-10 09:55:30 -07:00
Alirie Gray be28de8fbc
feat(tasks): deactivate task on unrecoverable error (#15369) 2019-10-09 13:51:03 -07:00
Lyon Hill f5e9b5e04f
feat(task): add type to some specific metrics in new execution. (#15340) 2019-10-08 15:58:41 -06:00
Alirie Gray a9df93b1fd
refactor(tasks): create coordinator for new scheduler/executor (#15268) 2019-09-26 13:55:23 -07:00
Mustafa 4fcf4c4ad1
Merge pull request #15248 from influxdata/elbehery-fix#4300
fix(storage): remove level=0 from TSM disk bytes metrics.
2019-09-26 18:21:38 +02:00