drove-cli 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {drove_cli-0.0.1 → drove_cli-0.0.2}/PKG-INFO +88 -50
- {drove_cli-0.0.1 → drove_cli-0.0.2}/README.md +87 -49
- {drove_cli-0.0.1 → drove_cli-0.0.2}/droveclient.py +4 -4
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/cluster.py +20 -7
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/executors.py +37 -3
- {drove_cli-0.0.1 → drove_cli-0.0.2}/pyproject.toml +1 -1
- {drove_cli-0.0.1 → drove_cli-0.0.2}/drove.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/drovecli.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/droveutils.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/__init__.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/appinstances.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/applications.py +0 -0
- {drove_cli-0.0.1 → drove_cli-0.0.2}/plugins/tasks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: drove-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: Drove Command Line Interface
|
|
5
5
|
Home-page: https://github.com/PhonePe/drove-cli
|
|
6
6
|
License: Apache-2.0
|
|
@@ -51,7 +51,7 @@ The cli is pushed as a docker for easy access. This also elimintates the need fo
|
|
|
51
51
|
|
|
52
52
|
1) Pull the image:
|
|
53
53
|
```shell
|
|
54
|
-
docker pull ghcr.io/
|
|
54
|
+
docker pull ghcr.io/phonepe/drove-cli:latest
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
2) Create a shell script called `drove` with the following content:
|
|
@@ -61,7 +61,7 @@ docker pull ghcr.io/PhonePe/drove-cli:latest
|
|
|
61
61
|
docker run \
|
|
62
62
|
--rm --interactive --tty --network host \
|
|
63
63
|
--name drove-cli -v ${HOME}/.drove:/root/.drove:ro \
|
|
64
|
-
ghcr.io/
|
|
64
|
+
ghcr.io/phonepe/drove-cli:latest "$@"
|
|
65
65
|
|
|
66
66
|
```
|
|
67
67
|
|
|
@@ -80,7 +80,7 @@ export PATH="${PATH}:/path/to/your/script"
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
6) Run drove cli
|
|
83
|
-
```
|
|
83
|
+
```shell
|
|
84
84
|
drove -h
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -130,18 +130,20 @@ options:
|
|
|
130
130
|
To see documentation for a command/section:
|
|
131
131
|
```
|
|
132
132
|
$ drove cluster -h
|
|
133
|
-
usage: drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
133
|
+
usage: drove cluster [-h] {ping,summary,leader,endpoints,events,maintenance-on,maintenance-off} ...
|
|
134
134
|
|
|
135
135
|
positional arguments:
|
|
136
|
-
{ping,summary,leader,endpoints,events}
|
|
136
|
+
{ping,summary,leader,endpoints,events,maintenance-on,maintenance-off}
|
|
137
137
|
Available commands for cluster management
|
|
138
138
|
ping Ping the cluster
|
|
139
139
|
summary Show cluster summary
|
|
140
140
|
leader Show leader for cluster
|
|
141
141
|
endpoints Show all exposed endpoints
|
|
142
142
|
events Events on the cluster
|
|
143
|
+
maintenance-on Set cluster to maintenance mode
|
|
144
|
+
maintenance-off Removed maintenance mode on cluster
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
options:
|
|
145
147
|
-h, --help show this help message and exit
|
|
146
148
|
```
|
|
147
149
|
|
|
@@ -274,17 +276,18 @@ usage: drove [-h] [--file FILE] [--cluster CLUSTER] [--endpoint ENDPOINT] [--aut
|
|
|
274
276
|
## Commands
|
|
275
277
|
Commands in drove are meant to address specific functionality. They can be summarized as follows:
|
|
276
278
|
```
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
list List all executors
|
|
280
|
+
info Show details about executor
|
|
281
|
+
appinstances Show app instances running on this executor
|
|
282
|
+
tasks Show tasks running on this executor
|
|
283
|
+
blacklist Blacklist executors
|
|
284
|
+
unblacklist Un-blacklist executors
|
|
282
285
|
```
|
|
283
286
|
### executor
|
|
284
287
|
---
|
|
285
288
|
Drove cluster executor related commands
|
|
286
289
|
|
|
287
|
-
```
|
|
290
|
+
```shell
|
|
288
291
|
drove executor [-h] {list,info,appinstances,tasks} ...
|
|
289
292
|
```
|
|
290
293
|
|
|
@@ -294,7 +297,7 @@ drove executor [-h] {list,info,appinstances,tasks} ...
|
|
|
294
297
|
|
|
295
298
|
List all executors
|
|
296
299
|
|
|
297
|
-
```
|
|
300
|
+
```shell
|
|
298
301
|
drove executor list [-h]
|
|
299
302
|
```
|
|
300
303
|
|
|
@@ -302,7 +305,7 @@ drove executor list [-h]
|
|
|
302
305
|
|
|
303
306
|
Show details about executor
|
|
304
307
|
|
|
305
|
-
```
|
|
308
|
+
```shell
|
|
306
309
|
drove executor info [-h] executor-id
|
|
307
310
|
```
|
|
308
311
|
|
|
@@ -314,7 +317,7 @@ drove executor info [-h] executor-id
|
|
|
314
317
|
|
|
315
318
|
Show app instances running on this executor
|
|
316
319
|
|
|
317
|
-
```
|
|
320
|
+
```shell
|
|
318
321
|
drove executor appinstances [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
319
322
|
```
|
|
320
323
|
###### Positional Arguments
|
|
@@ -333,7 +336,7 @@ drove executor appinstances [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
|
333
336
|
|
|
334
337
|
Show tasks running on this executor
|
|
335
338
|
|
|
336
|
-
```
|
|
339
|
+
```shell
|
|
337
340
|
drove executor tasks [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
338
341
|
```
|
|
339
342
|
|
|
@@ -348,12 +351,35 @@ drove executor tasks [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
|
348
351
|
--reverse, -r Sort in reverse order
|
|
349
352
|
```
|
|
350
353
|
|
|
354
|
+
##### blacklist
|
|
355
|
+
|
|
356
|
+
Take executors out of rotation.
|
|
357
|
+
|
|
358
|
+
```shell
|
|
359
|
+
drove executor blacklist executor-id [executor-id ...]
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
###### Positional Arguments
|
|
363
|
+
|
|
364
|
+
`executor-id` - List of executor ids to be blacklisted. At least one is mandatory.
|
|
365
|
+
|
|
366
|
+
##### unblacklist
|
|
367
|
+
|
|
368
|
+
Bring blacklisted executors back into rotation.
|
|
369
|
+
|
|
370
|
+
```shell
|
|
371
|
+
drove executor blacklist executor-id [executor-id ...]
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
###### Positional Arguments
|
|
375
|
+
|
|
376
|
+
`executor-id` - List of executor ids to be blacklisted. At least one is mandatory.
|
|
351
377
|
|
|
352
378
|
### cluster
|
|
353
379
|
---
|
|
354
380
|
Drove cluster related commands
|
|
355
381
|
|
|
356
|
-
```
|
|
382
|
+
```shell
|
|
357
383
|
drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
358
384
|
```
|
|
359
385
|
|
|
@@ -363,7 +389,7 @@ drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
|
363
389
|
|
|
364
390
|
Ping the cluster
|
|
365
391
|
|
|
366
|
-
```
|
|
392
|
+
```shell
|
|
367
393
|
drove cluster ping [-h]
|
|
368
394
|
```
|
|
369
395
|
|
|
@@ -371,20 +397,20 @@ drove cluster ping [-h]
|
|
|
371
397
|
|
|
372
398
|
Show cluster summary
|
|
373
399
|
|
|
374
|
-
```
|
|
400
|
+
```shell
|
|
375
401
|
drove cluster summary [-h]
|
|
376
402
|
```
|
|
377
403
|
|
|
378
404
|
##### leader
|
|
379
405
|
|
|
380
406
|
Show leader for cluster
|
|
381
|
-
```
|
|
407
|
+
```shell
|
|
382
408
|
drove cluster leader [-h]
|
|
383
409
|
```
|
|
384
410
|
##### endpoints
|
|
385
411
|
|
|
386
412
|
Show all exposed endpoints
|
|
387
|
-
```
|
|
413
|
+
```shell
|
|
388
414
|
drove cluster endpoints [-h] [--vhost VHOST]
|
|
389
415
|
```
|
|
390
416
|
|
|
@@ -399,7 +425,7 @@ drove cluster endpoints [-h] [--vhost VHOST]
|
|
|
399
425
|
|
|
400
426
|
Events on the cluster
|
|
401
427
|
|
|
402
|
-
```
|
|
428
|
+
```shell
|
|
403
429
|
drove cluster events [-h] [--follow] [--type TYPE] [--count COUNT] [--textfmt TEXTFMT]
|
|
404
430
|
```
|
|
405
431
|
|
|
@@ -414,12 +440,24 @@ drove cluster events [-h] [--follow] [--type TYPE] [--count COUNT] [--textfmt TE
|
|
|
414
440
|
Use the format string to print message
|
|
415
441
|
Default: “{type: <25} | {id: <36} | {time: <20} | {metadata}”
|
|
416
442
|
```
|
|
443
|
+
##### maintenance-on
|
|
444
|
+
Set cluster to maintenance mode.
|
|
445
|
+
|
|
446
|
+
```shell
|
|
447
|
+
drove cluster maintenance-on
|
|
448
|
+
```
|
|
449
|
+
##### maintenance-off
|
|
450
|
+
Set cluster to normal mode.
|
|
451
|
+
|
|
452
|
+
```shell
|
|
453
|
+
drove cluster maintenance-off
|
|
454
|
+
```
|
|
417
455
|
|
|
418
456
|
### apps
|
|
419
457
|
---
|
|
420
458
|
Drove application related commands
|
|
421
459
|
|
|
422
|
-
```
|
|
460
|
+
```shell
|
|
423
461
|
drove apps [-h] {list,summary,spec,create,destroy,deploy,scale,suspend,restart,cancelop} ...
|
|
424
462
|
```
|
|
425
463
|
#### Sub-commands
|
|
@@ -428,7 +466,7 @@ drove apps [-h] {list,summary,spec,create,destroy,deploy,scale,suspend,restart,c
|
|
|
428
466
|
|
|
429
467
|
List all applications
|
|
430
468
|
|
|
431
|
-
```
|
|
469
|
+
```shell
|
|
432
470
|
drove apps list [-h] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
433
471
|
```
|
|
434
472
|
|
|
@@ -443,7 +481,7 @@ drove apps list [-h] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
|
443
481
|
##### summary
|
|
444
482
|
|
|
445
483
|
Show a summary for an application
|
|
446
|
-
```
|
|
484
|
+
```shell
|
|
447
485
|
drove apps summary [-h] app-id
|
|
448
486
|
```
|
|
449
487
|
###### Positional Arguments
|
|
@@ -453,7 +491,7 @@ drove apps summary [-h] app-id
|
|
|
453
491
|
##### spec
|
|
454
492
|
|
|
455
493
|
Print the raw json spec for an application
|
|
456
|
-
```
|
|
494
|
+
```shell
|
|
457
495
|
drove apps spec [-h] app-id
|
|
458
496
|
```
|
|
459
497
|
###### Positional Arguments
|
|
@@ -463,7 +501,7 @@ drove apps spec [-h] app-id
|
|
|
463
501
|
##### create
|
|
464
502
|
|
|
465
503
|
Create application on cluster
|
|
466
|
-
```
|
|
504
|
+
```shell
|
|
467
505
|
drove apps create [-h] spec-file
|
|
468
506
|
```
|
|
469
507
|
###### Positional Arguments
|
|
@@ -473,7 +511,7 @@ drove apps create [-h] spec-file
|
|
|
473
511
|
##### destroy
|
|
474
512
|
|
|
475
513
|
Destroy an app with zero instances
|
|
476
|
-
```
|
|
514
|
+
```shell
|
|
477
515
|
drove apps destroy [-h] app-id
|
|
478
516
|
```
|
|
479
517
|
###### Positional Arguments
|
|
@@ -483,7 +521,7 @@ drove apps destroy [-h] app-id
|
|
|
483
521
|
##### deploy
|
|
484
522
|
|
|
485
523
|
Deploy new app instances.
|
|
486
|
-
```
|
|
524
|
+
```shell
|
|
487
525
|
drove apps deploy [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instances
|
|
488
526
|
```
|
|
489
527
|
###### Positional Arguments
|
|
@@ -504,7 +542,7 @@ drove apps deploy [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id in
|
|
|
504
542
|
|
|
505
543
|
Scale app to required instances. Will increase or decrease instances on the cluster to match this number
|
|
506
544
|
|
|
507
|
-
```
|
|
545
|
+
```shell
|
|
508
546
|
drove apps scale [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instances
|
|
509
547
|
```
|
|
510
548
|
###### Positional Arguments
|
|
@@ -525,7 +563,7 @@ drove apps scale [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id ins
|
|
|
525
563
|
##### suspend
|
|
526
564
|
|
|
527
565
|
Suspend the app
|
|
528
|
-
```
|
|
566
|
+
```shell
|
|
529
567
|
drove apps suspend [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
530
568
|
```
|
|
531
569
|
###### Positional Arguments[¶](#Positional%20Arguments_repeat9 "Link to this heading")
|
|
@@ -546,7 +584,7 @@ drove apps suspend [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
|
546
584
|
|
|
547
585
|
Restart am existing app instances.
|
|
548
586
|
|
|
549
|
-
```
|
|
587
|
+
```shell
|
|
550
588
|
drove apps restart [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
551
589
|
```
|
|
552
590
|
|
|
@@ -565,7 +603,7 @@ drove apps restart [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
|
565
603
|
##### cancelop
|
|
566
604
|
|
|
567
605
|
Cancel current operation
|
|
568
|
-
```
|
|
606
|
+
```shell
|
|
569
607
|
drove apps cancelop [-h] app-id
|
|
570
608
|
```
|
|
571
609
|
###### Positional Arguments
|
|
@@ -574,7 +612,7 @@ drove apps cancelop [-h] app-id
|
|
|
574
612
|
### appinstances
|
|
575
613
|
---
|
|
576
614
|
Drove application instance related commands
|
|
577
|
-
```
|
|
615
|
+
```shell
|
|
578
616
|
drove appinstances [-h] {list,info,logs,tail,download,replace,kill} ...
|
|
579
617
|
```
|
|
580
618
|
#### Sub-commands
|
|
@@ -582,7 +620,7 @@ drove appinstances [-h] {list,info,logs,tail,download,replace,kill} ...
|
|
|
582
620
|
##### list
|
|
583
621
|
|
|
584
622
|
List all application instances
|
|
585
|
-
```
|
|
623
|
+
```shell
|
|
586
624
|
drove appinstances list [-h] [--old] [--sort {0,1,2,3,4,5}] [--reverse] app-id
|
|
587
625
|
```
|
|
588
626
|
###### Positional Arguments
|
|
@@ -599,7 +637,7 @@ drove appinstances list [-h] [--old] [--sort {0,1,2,3,4,5}] [--reverse] app-id
|
|
|
599
637
|
##### info
|
|
600
638
|
|
|
601
639
|
Print details for an application instance
|
|
602
|
-
```
|
|
640
|
+
```shell
|
|
603
641
|
drove appinstances info [-h] app-id instance-id
|
|
604
642
|
```
|
|
605
643
|
###### Positional Arguments
|
|
@@ -609,7 +647,7 @@ drove appinstances info [-h] app-id instance-id
|
|
|
609
647
|
##### logs
|
|
610
648
|
|
|
611
649
|
Print list of logs for application instance
|
|
612
|
-
```
|
|
650
|
+
```shell
|
|
613
651
|
drove appinstances logs [-h] app-id instance-id
|
|
614
652
|
```
|
|
615
653
|
###### Positional Arguments
|
|
@@ -620,7 +658,7 @@ drove appinstances logs [-h] app-id instance-id
|
|
|
620
658
|
##### tail
|
|
621
659
|
|
|
622
660
|
Tail log for application instance
|
|
623
|
-
```
|
|
661
|
+
```shell
|
|
624
662
|
drove appinstances tail [-h] [--file FILE] app-id instance-id
|
|
625
663
|
```
|
|
626
664
|
###### Positional Arguments
|
|
@@ -637,7 +675,7 @@ drove appinstances tail [-h] [--file FILE] app-id instance-id
|
|
|
637
675
|
##### download
|
|
638
676
|
|
|
639
677
|
Download log for application instance
|
|
640
|
-
```
|
|
678
|
+
```shell
|
|
641
679
|
drove appinstances download [-h] [--out OUT] app-id instance-id file
|
|
642
680
|
```
|
|
643
681
|
###### Positional Arguments
|
|
@@ -653,7 +691,7 @@ drove appinstances download [-h] [--out OUT] app-id instance-id file
|
|
|
653
691
|
##### replace
|
|
654
692
|
|
|
655
693
|
Replace specific app instances with fresh instances
|
|
656
|
-
```
|
|
694
|
+
```shell
|
|
657
695
|
drove appinstances replace [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instance-id [instance-id ...]
|
|
658
696
|
```
|
|
659
697
|
###### Positional Arguments
|
|
@@ -672,7 +710,7 @@ drove appinstances replace [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT]
|
|
|
672
710
|
##### kill
|
|
673
711
|
|
|
674
712
|
Kill specific app instances
|
|
675
|
-
```
|
|
713
|
+
```shell
|
|
676
714
|
drove appinstances kill [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instance-id [instance-id ...]
|
|
677
715
|
```
|
|
678
716
|
###### Positional Arguments
|
|
@@ -691,7 +729,7 @@ drove appinstances kill [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app
|
|
|
691
729
|
### tasks
|
|
692
730
|
---
|
|
693
731
|
Drove task related commands
|
|
694
|
-
```
|
|
732
|
+
```shell
|
|
695
733
|
drove tasks [-h] {create,kill,list,show,logs,tail,download} ...
|
|
696
734
|
```
|
|
697
735
|
#### Sub-commands
|
|
@@ -699,7 +737,7 @@ drove tasks [-h] {create,kill,list,show,logs,tail,download} ...
|
|
|
699
737
|
##### create
|
|
700
738
|
|
|
701
739
|
Create a task on cluster
|
|
702
|
-
```
|
|
740
|
+
```shell
|
|
703
741
|
drove tasks create [-h] spec-file
|
|
704
742
|
```
|
|
705
743
|
###### Positional Arguments
|
|
@@ -709,7 +747,7 @@ drove tasks create [-h] spec-file
|
|
|
709
747
|
##### kill
|
|
710
748
|
|
|
711
749
|
Kill a running task
|
|
712
|
-
```
|
|
750
|
+
```shell
|
|
713
751
|
drove tasks kill [-h] source-app-name task-id
|
|
714
752
|
```
|
|
715
753
|
###### Positional Arguments
|
|
@@ -720,7 +758,7 @@ drove tasks kill [-h] source-app-name task-id
|
|
|
720
758
|
##### list
|
|
721
759
|
|
|
722
760
|
List all active tasks
|
|
723
|
-
```
|
|
761
|
+
```shell
|
|
724
762
|
drove tasks list [-h] [--app APP] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
725
763
|
```
|
|
726
764
|
###### Named Arguments
|
|
@@ -733,7 +771,7 @@ drove tasks list [-h] [--app APP] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
|
733
771
|
##### show
|
|
734
772
|
|
|
735
773
|
Shows details about a task
|
|
736
|
-
```
|
|
774
|
+
```shell
|
|
737
775
|
drove tasks show [-h] source-app task-id
|
|
738
776
|
```
|
|
739
777
|
###### Positional Arguments
|
|
@@ -743,7 +781,7 @@ drove tasks show [-h] source-app task-id
|
|
|
743
781
|
##### logs
|
|
744
782
|
|
|
745
783
|
Print list of logs for task
|
|
746
|
-
```
|
|
784
|
+
```shell
|
|
747
785
|
drove tasks logs [-h] source-app task-id
|
|
748
786
|
```
|
|
749
787
|
###### Positional Arguments
|
|
@@ -753,7 +791,7 @@ drove tasks logs [-h] source-app task-id
|
|
|
753
791
|
##### tail
|
|
754
792
|
|
|
755
793
|
Tail log for task
|
|
756
|
-
```
|
|
794
|
+
```shell
|
|
757
795
|
drove tasks tail [-h] [--file FILE] source-app task-id
|
|
758
796
|
```
|
|
759
797
|
###### Positional Arguments
|
|
@@ -769,7 +807,7 @@ drove tasks tail [-h] [--file FILE] source-app task-id
|
|
|
769
807
|
|
|
770
808
|
Download log for task
|
|
771
809
|
|
|
772
|
-
```
|
|
810
|
+
```shell
|
|
773
811
|
drove tasks download [-h] [--out OUT] source-app task-id file
|
|
774
812
|
```
|
|
775
813
|
###### Positional Arguments
|
|
@@ -19,7 +19,7 @@ The cli is pushed as a docker for easy access. This also elimintates the need fo
|
|
|
19
19
|
|
|
20
20
|
1) Pull the image:
|
|
21
21
|
```shell
|
|
22
|
-
docker pull ghcr.io/
|
|
22
|
+
docker pull ghcr.io/phonepe/drove-cli:latest
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
2) Create a shell script called `drove` with the following content:
|
|
@@ -29,7 +29,7 @@ docker pull ghcr.io/PhonePe/drove-cli:latest
|
|
|
29
29
|
docker run \
|
|
30
30
|
--rm --interactive --tty --network host \
|
|
31
31
|
--name drove-cli -v ${HOME}/.drove:/root/.drove:ro \
|
|
32
|
-
ghcr.io/
|
|
32
|
+
ghcr.io/phonepe/drove-cli:latest "$@"
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -48,7 +48,7 @@ export PATH="${PATH}:/path/to/your/script"
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
6) Run drove cli
|
|
51
|
-
```
|
|
51
|
+
```shell
|
|
52
52
|
drove -h
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -98,18 +98,20 @@ options:
|
|
|
98
98
|
To see documentation for a command/section:
|
|
99
99
|
```
|
|
100
100
|
$ drove cluster -h
|
|
101
|
-
usage: drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
101
|
+
usage: drove cluster [-h] {ping,summary,leader,endpoints,events,maintenance-on,maintenance-off} ...
|
|
102
102
|
|
|
103
103
|
positional arguments:
|
|
104
|
-
{ping,summary,leader,endpoints,events}
|
|
104
|
+
{ping,summary,leader,endpoints,events,maintenance-on,maintenance-off}
|
|
105
105
|
Available commands for cluster management
|
|
106
106
|
ping Ping the cluster
|
|
107
107
|
summary Show cluster summary
|
|
108
108
|
leader Show leader for cluster
|
|
109
109
|
endpoints Show all exposed endpoints
|
|
110
110
|
events Events on the cluster
|
|
111
|
+
maintenance-on Set cluster to maintenance mode
|
|
112
|
+
maintenance-off Removed maintenance mode on cluster
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
options:
|
|
113
115
|
-h, --help show this help message and exit
|
|
114
116
|
```
|
|
115
117
|
|
|
@@ -242,17 +244,18 @@ usage: drove [-h] [--file FILE] [--cluster CLUSTER] [--endpoint ENDPOINT] [--aut
|
|
|
242
244
|
## Commands
|
|
243
245
|
Commands in drove are meant to address specific functionality. They can be summarized as follows:
|
|
244
246
|
```
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
list List all executors
|
|
248
|
+
info Show details about executor
|
|
249
|
+
appinstances Show app instances running on this executor
|
|
250
|
+
tasks Show tasks running on this executor
|
|
251
|
+
blacklist Blacklist executors
|
|
252
|
+
unblacklist Un-blacklist executors
|
|
250
253
|
```
|
|
251
254
|
### executor
|
|
252
255
|
---
|
|
253
256
|
Drove cluster executor related commands
|
|
254
257
|
|
|
255
|
-
```
|
|
258
|
+
```shell
|
|
256
259
|
drove executor [-h] {list,info,appinstances,tasks} ...
|
|
257
260
|
```
|
|
258
261
|
|
|
@@ -262,7 +265,7 @@ drove executor [-h] {list,info,appinstances,tasks} ...
|
|
|
262
265
|
|
|
263
266
|
List all executors
|
|
264
267
|
|
|
265
|
-
```
|
|
268
|
+
```shell
|
|
266
269
|
drove executor list [-h]
|
|
267
270
|
```
|
|
268
271
|
|
|
@@ -270,7 +273,7 @@ drove executor list [-h]
|
|
|
270
273
|
|
|
271
274
|
Show details about executor
|
|
272
275
|
|
|
273
|
-
```
|
|
276
|
+
```shell
|
|
274
277
|
drove executor info [-h] executor-id
|
|
275
278
|
```
|
|
276
279
|
|
|
@@ -282,7 +285,7 @@ drove executor info [-h] executor-id
|
|
|
282
285
|
|
|
283
286
|
Show app instances running on this executor
|
|
284
287
|
|
|
285
|
-
```
|
|
288
|
+
```shell
|
|
286
289
|
drove executor appinstances [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
287
290
|
```
|
|
288
291
|
###### Positional Arguments
|
|
@@ -301,7 +304,7 @@ drove executor appinstances [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
|
301
304
|
|
|
302
305
|
Show tasks running on this executor
|
|
303
306
|
|
|
304
|
-
```
|
|
307
|
+
```shell
|
|
305
308
|
drove executor tasks [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
306
309
|
```
|
|
307
310
|
|
|
@@ -316,12 +319,35 @@ drove executor tasks [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
|
|
|
316
319
|
--reverse, -r Sort in reverse order
|
|
317
320
|
```
|
|
318
321
|
|
|
322
|
+
##### blacklist
|
|
323
|
+
|
|
324
|
+
Take executors out of rotation.
|
|
325
|
+
|
|
326
|
+
```shell
|
|
327
|
+
drove executor blacklist executor-id [executor-id ...]
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
###### Positional Arguments
|
|
331
|
+
|
|
332
|
+
`executor-id` - List of executor ids to be blacklisted. At least one is mandatory.
|
|
333
|
+
|
|
334
|
+
##### unblacklist
|
|
335
|
+
|
|
336
|
+
Bring blacklisted executors back into rotation.
|
|
337
|
+
|
|
338
|
+
```shell
|
|
339
|
+
drove executor blacklist executor-id [executor-id ...]
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
###### Positional Arguments
|
|
343
|
+
|
|
344
|
+
`executor-id` - List of executor ids to be blacklisted. At least one is mandatory.
|
|
319
345
|
|
|
320
346
|
### cluster
|
|
321
347
|
---
|
|
322
348
|
Drove cluster related commands
|
|
323
349
|
|
|
324
|
-
```
|
|
350
|
+
```shell
|
|
325
351
|
drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
326
352
|
```
|
|
327
353
|
|
|
@@ -331,7 +357,7 @@ drove cluster [-h] {ping,summary,leader,endpoints,events} ...
|
|
|
331
357
|
|
|
332
358
|
Ping the cluster
|
|
333
359
|
|
|
334
|
-
```
|
|
360
|
+
```shell
|
|
335
361
|
drove cluster ping [-h]
|
|
336
362
|
```
|
|
337
363
|
|
|
@@ -339,20 +365,20 @@ drove cluster ping [-h]
|
|
|
339
365
|
|
|
340
366
|
Show cluster summary
|
|
341
367
|
|
|
342
|
-
```
|
|
368
|
+
```shell
|
|
343
369
|
drove cluster summary [-h]
|
|
344
370
|
```
|
|
345
371
|
|
|
346
372
|
##### leader
|
|
347
373
|
|
|
348
374
|
Show leader for cluster
|
|
349
|
-
```
|
|
375
|
+
```shell
|
|
350
376
|
drove cluster leader [-h]
|
|
351
377
|
```
|
|
352
378
|
##### endpoints
|
|
353
379
|
|
|
354
380
|
Show all exposed endpoints
|
|
355
|
-
```
|
|
381
|
+
```shell
|
|
356
382
|
drove cluster endpoints [-h] [--vhost VHOST]
|
|
357
383
|
```
|
|
358
384
|
|
|
@@ -367,7 +393,7 @@ drove cluster endpoints [-h] [--vhost VHOST]
|
|
|
367
393
|
|
|
368
394
|
Events on the cluster
|
|
369
395
|
|
|
370
|
-
```
|
|
396
|
+
```shell
|
|
371
397
|
drove cluster events [-h] [--follow] [--type TYPE] [--count COUNT] [--textfmt TEXTFMT]
|
|
372
398
|
```
|
|
373
399
|
|
|
@@ -382,12 +408,24 @@ drove cluster events [-h] [--follow] [--type TYPE] [--count COUNT] [--textfmt TE
|
|
|
382
408
|
Use the format string to print message
|
|
383
409
|
Default: “{type: <25} | {id: <36} | {time: <20} | {metadata}”
|
|
384
410
|
```
|
|
411
|
+
##### maintenance-on
|
|
412
|
+
Set cluster to maintenance mode.
|
|
413
|
+
|
|
414
|
+
```shell
|
|
415
|
+
drove cluster maintenance-on
|
|
416
|
+
```
|
|
417
|
+
##### maintenance-off
|
|
418
|
+
Set cluster to normal mode.
|
|
419
|
+
|
|
420
|
+
```shell
|
|
421
|
+
drove cluster maintenance-off
|
|
422
|
+
```
|
|
385
423
|
|
|
386
424
|
### apps
|
|
387
425
|
---
|
|
388
426
|
Drove application related commands
|
|
389
427
|
|
|
390
|
-
```
|
|
428
|
+
```shell
|
|
391
429
|
drove apps [-h] {list,summary,spec,create,destroy,deploy,scale,suspend,restart,cancelop} ...
|
|
392
430
|
```
|
|
393
431
|
#### Sub-commands
|
|
@@ -396,7 +434,7 @@ drove apps [-h] {list,summary,spec,create,destroy,deploy,scale,suspend,restart,c
|
|
|
396
434
|
|
|
397
435
|
List all applications
|
|
398
436
|
|
|
399
|
-
```
|
|
437
|
+
```shell
|
|
400
438
|
drove apps list [-h] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
401
439
|
```
|
|
402
440
|
|
|
@@ -411,7 +449,7 @@ drove apps list [-h] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
|
411
449
|
##### summary
|
|
412
450
|
|
|
413
451
|
Show a summary for an application
|
|
414
|
-
```
|
|
452
|
+
```shell
|
|
415
453
|
drove apps summary [-h] app-id
|
|
416
454
|
```
|
|
417
455
|
###### Positional Arguments
|
|
@@ -421,7 +459,7 @@ drove apps summary [-h] app-id
|
|
|
421
459
|
##### spec
|
|
422
460
|
|
|
423
461
|
Print the raw json spec for an application
|
|
424
|
-
```
|
|
462
|
+
```shell
|
|
425
463
|
drove apps spec [-h] app-id
|
|
426
464
|
```
|
|
427
465
|
###### Positional Arguments
|
|
@@ -431,7 +469,7 @@ drove apps spec [-h] app-id
|
|
|
431
469
|
##### create
|
|
432
470
|
|
|
433
471
|
Create application on cluster
|
|
434
|
-
```
|
|
472
|
+
```shell
|
|
435
473
|
drove apps create [-h] spec-file
|
|
436
474
|
```
|
|
437
475
|
###### Positional Arguments
|
|
@@ -441,7 +479,7 @@ drove apps create [-h] spec-file
|
|
|
441
479
|
##### destroy
|
|
442
480
|
|
|
443
481
|
Destroy an app with zero instances
|
|
444
|
-
```
|
|
482
|
+
```shell
|
|
445
483
|
drove apps destroy [-h] app-id
|
|
446
484
|
```
|
|
447
485
|
###### Positional Arguments
|
|
@@ -451,7 +489,7 @@ drove apps destroy [-h] app-id
|
|
|
451
489
|
##### deploy
|
|
452
490
|
|
|
453
491
|
Deploy new app instances.
|
|
454
|
-
```
|
|
492
|
+
```shell
|
|
455
493
|
drove apps deploy [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instances
|
|
456
494
|
```
|
|
457
495
|
###### Positional Arguments
|
|
@@ -472,7 +510,7 @@ drove apps deploy [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id in
|
|
|
472
510
|
|
|
473
511
|
Scale app to required instances. Will increase or decrease instances on the cluster to match this number
|
|
474
512
|
|
|
475
|
-
```
|
|
513
|
+
```shell
|
|
476
514
|
drove apps scale [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instances
|
|
477
515
|
```
|
|
478
516
|
###### Positional Arguments
|
|
@@ -493,7 +531,7 @@ drove apps scale [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id ins
|
|
|
493
531
|
##### suspend
|
|
494
532
|
|
|
495
533
|
Suspend the app
|
|
496
|
-
```
|
|
534
|
+
```shell
|
|
497
535
|
drove apps suspend [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
498
536
|
```
|
|
499
537
|
###### Positional Arguments[¶](#Positional%20Arguments_repeat9 "Link to this heading")
|
|
@@ -514,7 +552,7 @@ drove apps suspend [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
|
514
552
|
|
|
515
553
|
Restart am existing app instances.
|
|
516
554
|
|
|
517
|
-
```
|
|
555
|
+
```shell
|
|
518
556
|
drove apps restart [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
519
557
|
```
|
|
520
558
|
|
|
@@ -533,7 +571,7 @@ drove apps restart [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id
|
|
|
533
571
|
##### cancelop
|
|
534
572
|
|
|
535
573
|
Cancel current operation
|
|
536
|
-
```
|
|
574
|
+
```shell
|
|
537
575
|
drove apps cancelop [-h] app-id
|
|
538
576
|
```
|
|
539
577
|
###### Positional Arguments
|
|
@@ -542,7 +580,7 @@ drove apps cancelop [-h] app-id
|
|
|
542
580
|
### appinstances
|
|
543
581
|
---
|
|
544
582
|
Drove application instance related commands
|
|
545
|
-
```
|
|
583
|
+
```shell
|
|
546
584
|
drove appinstances [-h] {list,info,logs,tail,download,replace,kill} ...
|
|
547
585
|
```
|
|
548
586
|
#### Sub-commands
|
|
@@ -550,7 +588,7 @@ drove appinstances [-h] {list,info,logs,tail,download,replace,kill} ...
|
|
|
550
588
|
##### list
|
|
551
589
|
|
|
552
590
|
List all application instances
|
|
553
|
-
```
|
|
591
|
+
```shell
|
|
554
592
|
drove appinstances list [-h] [--old] [--sort {0,1,2,3,4,5}] [--reverse] app-id
|
|
555
593
|
```
|
|
556
594
|
###### Positional Arguments
|
|
@@ -567,7 +605,7 @@ drove appinstances list [-h] [--old] [--sort {0,1,2,3,4,5}] [--reverse] app-id
|
|
|
567
605
|
##### info
|
|
568
606
|
|
|
569
607
|
Print details for an application instance
|
|
570
|
-
```
|
|
608
|
+
```shell
|
|
571
609
|
drove appinstances info [-h] app-id instance-id
|
|
572
610
|
```
|
|
573
611
|
###### Positional Arguments
|
|
@@ -577,7 +615,7 @@ drove appinstances info [-h] app-id instance-id
|
|
|
577
615
|
##### logs
|
|
578
616
|
|
|
579
617
|
Print list of logs for application instance
|
|
580
|
-
```
|
|
618
|
+
```shell
|
|
581
619
|
drove appinstances logs [-h] app-id instance-id
|
|
582
620
|
```
|
|
583
621
|
###### Positional Arguments
|
|
@@ -588,7 +626,7 @@ drove appinstances logs [-h] app-id instance-id
|
|
|
588
626
|
##### tail
|
|
589
627
|
|
|
590
628
|
Tail log for application instance
|
|
591
|
-
```
|
|
629
|
+
```shell
|
|
592
630
|
drove appinstances tail [-h] [--file FILE] app-id instance-id
|
|
593
631
|
```
|
|
594
632
|
###### Positional Arguments
|
|
@@ -605,7 +643,7 @@ drove appinstances tail [-h] [--file FILE] app-id instance-id
|
|
|
605
643
|
##### download
|
|
606
644
|
|
|
607
645
|
Download log for application instance
|
|
608
|
-
```
|
|
646
|
+
```shell
|
|
609
647
|
drove appinstances download [-h] [--out OUT] app-id instance-id file
|
|
610
648
|
```
|
|
611
649
|
###### Positional Arguments
|
|
@@ -621,7 +659,7 @@ drove appinstances download [-h] [--out OUT] app-id instance-id file
|
|
|
621
659
|
##### replace
|
|
622
660
|
|
|
623
661
|
Replace specific app instances with fresh instances
|
|
624
|
-
```
|
|
662
|
+
```shell
|
|
625
663
|
drove appinstances replace [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instance-id [instance-id ...]
|
|
626
664
|
```
|
|
627
665
|
###### Positional Arguments
|
|
@@ -640,7 +678,7 @@ drove appinstances replace [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT]
|
|
|
640
678
|
##### kill
|
|
641
679
|
|
|
642
680
|
Kill specific app instances
|
|
643
|
-
```
|
|
681
|
+
```shell
|
|
644
682
|
drove appinstances kill [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app-id instance-id [instance-id ...]
|
|
645
683
|
```
|
|
646
684
|
###### Positional Arguments
|
|
@@ -659,7 +697,7 @@ drove appinstances kill [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] app
|
|
|
659
697
|
### tasks
|
|
660
698
|
---
|
|
661
699
|
Drove task related commands
|
|
662
|
-
```
|
|
700
|
+
```shell
|
|
663
701
|
drove tasks [-h] {create,kill,list,show,logs,tail,download} ...
|
|
664
702
|
```
|
|
665
703
|
#### Sub-commands
|
|
@@ -667,7 +705,7 @@ drove tasks [-h] {create,kill,list,show,logs,tail,download} ...
|
|
|
667
705
|
##### create
|
|
668
706
|
|
|
669
707
|
Create a task on cluster
|
|
670
|
-
```
|
|
708
|
+
```shell
|
|
671
709
|
drove tasks create [-h] spec-file
|
|
672
710
|
```
|
|
673
711
|
###### Positional Arguments
|
|
@@ -677,7 +715,7 @@ drove tasks create [-h] spec-file
|
|
|
677
715
|
##### kill
|
|
678
716
|
|
|
679
717
|
Kill a running task
|
|
680
|
-
```
|
|
718
|
+
```shell
|
|
681
719
|
drove tasks kill [-h] source-app-name task-id
|
|
682
720
|
```
|
|
683
721
|
###### Positional Arguments
|
|
@@ -688,7 +726,7 @@ drove tasks kill [-h] source-app-name task-id
|
|
|
688
726
|
##### list
|
|
689
727
|
|
|
690
728
|
List all active tasks
|
|
691
|
-
```
|
|
729
|
+
```shell
|
|
692
730
|
drove tasks list [-h] [--app APP] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
693
731
|
```
|
|
694
732
|
###### Named Arguments
|
|
@@ -701,7 +739,7 @@ drove tasks list [-h] [--app APP] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
|
|
|
701
739
|
##### show
|
|
702
740
|
|
|
703
741
|
Shows details about a task
|
|
704
|
-
```
|
|
742
|
+
```shell
|
|
705
743
|
drove tasks show [-h] source-app task-id
|
|
706
744
|
```
|
|
707
745
|
###### Positional Arguments
|
|
@@ -711,7 +749,7 @@ drove tasks show [-h] source-app task-id
|
|
|
711
749
|
##### logs
|
|
712
750
|
|
|
713
751
|
Print list of logs for task
|
|
714
|
-
```
|
|
752
|
+
```shell
|
|
715
753
|
drove tasks logs [-h] source-app task-id
|
|
716
754
|
```
|
|
717
755
|
###### Positional Arguments
|
|
@@ -721,7 +759,7 @@ drove tasks logs [-h] source-app task-id
|
|
|
721
759
|
##### tail
|
|
722
760
|
|
|
723
761
|
Tail log for task
|
|
724
|
-
```
|
|
762
|
+
```shell
|
|
725
763
|
drove tasks tail [-h] [--file FILE] source-app task-id
|
|
726
764
|
```
|
|
727
765
|
###### Positional Arguments
|
|
@@ -737,7 +775,7 @@ drove tasks tail [-h] [--file FILE] source-app task-id
|
|
|
737
775
|
|
|
738
776
|
Download log for task
|
|
739
777
|
|
|
740
|
-
```
|
|
778
|
+
```shell
|
|
741
779
|
drove tasks download [-h] [--out OUT] source-app task-id file
|
|
742
780
|
```
|
|
743
781
|
###### Positional Arguments
|
|
@@ -70,9 +70,9 @@ class DroveClient:
|
|
|
70
70
|
return set(instances)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
def get(self, path: str, expected_status = 200) -> dict:
|
|
73
|
+
def get(self, path: str, params = None, expected_status = 200) -> dict:
|
|
74
74
|
try:
|
|
75
|
-
response = self.session.get(self.endpoint + path)
|
|
75
|
+
response = self.session.get(self.endpoint + path, params=params)
|
|
76
76
|
except requests.ConnectionError as e:
|
|
77
77
|
raise DroveException(-1, "Error connecting to endpoint " + self.endpoint, raw={})
|
|
78
78
|
return handle_drove_response(response, expected_status)
|
|
@@ -111,9 +111,9 @@ class DroveClient:
|
|
|
111
111
|
except Exception as e:
|
|
112
112
|
raise DroveException(-1, str(e))
|
|
113
113
|
|
|
114
|
-
def post(self, path: str, body: dict, parse=True, expected_status = 200) -> dict:
|
|
114
|
+
def post(self, path: str, body: dict, params = None, parse=True, expected_status = 200) -> dict:
|
|
115
115
|
try:
|
|
116
|
-
response = self.session.post(self.endpoint + path, json=body)
|
|
116
|
+
response = self.session.post(self.endpoint + path, json=body, params=params)
|
|
117
117
|
except requests.ConnectionError as e:
|
|
118
118
|
raise DroveException(-1, "Error connecting to endpoint " + self.endpoint, raw={})
|
|
119
119
|
return handle_drove_response(response, expected_status)
|
|
@@ -38,12 +38,11 @@ class Cluster(plugins.DrovePlugin):
|
|
|
38
38
|
sub_parser.add_argument("--textfmt", "-s", help="Use the format string to print message", type=str, default="{type: <25} | {id: <36} | {time: <20} | {metadata}")
|
|
39
39
|
sub_parser.set_defaults(func=self.handle_events)
|
|
40
40
|
|
|
41
|
+
maintenance_parser = commands.add_parser("maintenance-on", help="Set cluster to maintenance mode")
|
|
42
|
+
maintenance_parser.set_defaults(func=self.set_maintenance)
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# maintenance_parser = commands.add_parser("maintenance-off", help="Removed maintenance mode on cluster")
|
|
46
|
-
# maintenance_parser.set_defaults(func=self.unset_maintenance)
|
|
44
|
+
maintenance_parser = commands.add_parser("maintenance-off", help="Removed maintenance mode on cluster")
|
|
45
|
+
maintenance_parser.set_defaults(func=self.unset_maintenance)
|
|
47
46
|
|
|
48
47
|
# executors_command = commands.add_parser("executors", help="List executors")
|
|
49
48
|
# executors_command.add_argument("--list", "-l", help="List executors", action="store_true")
|
|
@@ -101,10 +100,24 @@ class Cluster(plugins.DrovePlugin):
|
|
|
101
100
|
time.sleep(1)
|
|
102
101
|
|
|
103
102
|
def set_maintenance(self, options: SimpleNamespace):
|
|
104
|
-
|
|
103
|
+
try:
|
|
104
|
+
response = self.drove_client.post("/apis/v1/cluster/maintenance/set", body={})
|
|
105
|
+
print("Cluster state: {state}".format(state=response['state']))
|
|
106
|
+
except droveclient.DroveException as e:
|
|
107
|
+
print("Error setting drove cluster to maintenance mode: status: {status} message: {message} raw: {raw}"
|
|
108
|
+
.format(status = e.status_code, message = str(e), raw = e.raw))
|
|
109
|
+
except Exception as e:
|
|
110
|
+
print("Error setting drove cluster to maintenance mode: " + str(e))
|
|
105
111
|
|
|
106
112
|
def unset_maintenance(self, options: SimpleNamespace):
|
|
107
|
-
|
|
113
|
+
try:
|
|
114
|
+
self.drove_client.post("/apis/v1/cluster/maintenance/unset", body={})
|
|
115
|
+
print("Maintenance mode removal accepted. Not that cluster will be in maintenance mode for an addition few minutes");
|
|
116
|
+
except droveclient.DroveException as e:
|
|
117
|
+
print("Error setting drove cluster to normal mode: status: {status} message: {message} raw: {raw}"
|
|
118
|
+
.format(status = e.status_code, message = str(e), raw = e.raw))
|
|
119
|
+
except Exception as e:
|
|
120
|
+
print("Error setting drove cluster to normal mode: " + str(e))
|
|
108
121
|
|
|
109
122
|
def convert_event(self, format: str, event: dict) -> str:
|
|
110
123
|
data = dict()
|
|
@@ -2,11 +2,10 @@ import argparse
|
|
|
2
2
|
from operator import itemgetter
|
|
3
3
|
import droveclient
|
|
4
4
|
import droveutils
|
|
5
|
-
import json
|
|
6
5
|
import plugins
|
|
7
|
-
import time
|
|
8
6
|
|
|
9
7
|
from types import SimpleNamespace
|
|
8
|
+
from urllib.parse import urlencode
|
|
10
9
|
|
|
11
10
|
class Executors(plugins.DrovePlugin):
|
|
12
11
|
def __init__(self) -> None:
|
|
@@ -37,6 +36,14 @@ class Executors(plugins.DrovePlugin):
|
|
|
37
36
|
sub_parser.add_argument("--reverse", "-r", help="Sort in reverse order", action="store_true")
|
|
38
37
|
sub_parser.set_defaults(func=self.show_tasks)
|
|
39
38
|
|
|
39
|
+
sub_parser = commands.add_parser("blacklist", help="Blacklist executors")
|
|
40
|
+
sub_parser.add_argument("executor_ids", nargs="+", metavar="executor-id", help="Executor IDs")
|
|
41
|
+
sub_parser.set_defaults(func=self.blacklist)
|
|
42
|
+
|
|
43
|
+
sub_parser = commands.add_parser("unblacklist", help="Un-blacklist executors")
|
|
44
|
+
sub_parser.add_argument("executor_ids", nargs="+", metavar="executor-id", help="Executor IDs")
|
|
45
|
+
sub_parser.set_defaults(func=self.unblacklist)
|
|
46
|
+
|
|
40
47
|
super().populate_options(drove_client, parser)
|
|
41
48
|
|
|
42
49
|
def list(self, options: SimpleNamespace):
|
|
@@ -126,4 +133,31 @@ class Executors(plugins.DrovePlugin):
|
|
|
126
133
|
|
|
127
134
|
task_rows = sorted(task_rows, key=itemgetter(options.sort), reverse=options.reverse)
|
|
128
135
|
headers = ["Id", "Source App", "Task ID", "State", "CPU", "Memory(MB)", "Created", "Updated"]
|
|
129
|
-
droveutils.print_table(headers, task_rows)
|
|
136
|
+
droveutils.print_table(headers, task_rows)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def blacklist(self, options: SimpleNamespace):
|
|
140
|
+
try:
|
|
141
|
+
response = self.drove_client.post("/apis/v1/cluster/executors/blacklist", params={'id' : options.executor_ids}, body={})
|
|
142
|
+
successful = response["successful"]
|
|
143
|
+
failed = response["failed"]
|
|
144
|
+
print("Successful: " + ",".join(successful))
|
|
145
|
+
print("Failed: " + ",".join(failed))
|
|
146
|
+
except droveclient.DroveException as e:
|
|
147
|
+
print("Error blacklisting: status: {status} message: {message} raw: {raw}"
|
|
148
|
+
.format(status = e.status_code, message = str(e), raw = e.raw))
|
|
149
|
+
except Exception as e:
|
|
150
|
+
print("Error blacklisting: " + str(e))
|
|
151
|
+
|
|
152
|
+
def unblacklist(self, options: SimpleNamespace):
|
|
153
|
+
try:
|
|
154
|
+
response = self.drove_client.post("/apis/v1/cluster/executors/unblacklist", params={'id' : options.executor_ids}, body={})
|
|
155
|
+
successful = response["successful"]
|
|
156
|
+
failed = response["failed"]
|
|
157
|
+
print("Successful: " + ",".join(successful))
|
|
158
|
+
print("Failed: " + ",".join(failed))
|
|
159
|
+
except droveclient.DroveException as e:
|
|
160
|
+
print("Error un-blacklisting: status: {status} message: {message} raw: {raw}"
|
|
161
|
+
.format(status = e.status_code, message = str(e), raw = e.raw))
|
|
162
|
+
except Exception as e:
|
|
163
|
+
print("Error un-blacklisting: " + str(e))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|