Merge branch 'aurora-scheduler:main' into master
This commit is contained in:
commit
c6adde03af
2 changed files with 37 additions and 0 deletions
35
cmd/fetch.go
35
cmd/fetch.go
|
@ -103,6 +103,9 @@ func init() {
|
|||
|
||||
// Fetch Status
|
||||
fetchCmd.AddCommand(fetchStatusCmd)
|
||||
|
||||
// fetch quota
|
||||
fetchCmd.AddCommand(fetchQuotaCmd)
|
||||
}
|
||||
|
||||
var fetchCmd = &cobra.Command{
|
||||
|
@ -173,6 +176,13 @@ var fetchStatusCmd = &cobra.Command{
|
|||
Run: fetchHostStatus,
|
||||
}
|
||||
|
||||
var fetchQuotaCmd = &cobra.Command{
|
||||
Use: "quota",
|
||||
Short: "Fetch the quotas of given roles",
|
||||
Long: `This command will print list of resource quotas with the aggregated resources for the given roles`,
|
||||
Run: fetchQuota,
|
||||
}
|
||||
|
||||
func fetchTasksConfig(cmd *cobra.Command, args []string) {
|
||||
log.Infof("Fetching job configuration for [%s/%s/%s] \n", *env, *role, *name)
|
||||
|
||||
|
@ -381,3 +391,28 @@ func fetchJobs(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//fetchQuota gets quotas for roles in args
|
||||
func fetchQuota(cmd *cobra.Command, args []string) {
|
||||
for _, role := range args {
|
||||
log.Infof("Fetching quota for role: %s \n", role)
|
||||
result, err := client.GetQuota(role)
|
||||
if err != nil {
|
||||
log.Fatalf("error: %+v\n", err)
|
||||
}
|
||||
|
||||
if toJson {
|
||||
fmt.Println(internal.ToJSON(result))
|
||||
} else {
|
||||
fmt.Printf(" Quota: %v\n", internal.ToJSON(result.Quota.GetResources()))
|
||||
fmt.Printf(" Aggregated Resources: \n")
|
||||
fmt.Printf(" ProdSharedConsumption: %v\n", internal.ToJSON(result.ProdSharedConsumption.GetResources()))
|
||||
fmt.Printf(" NonProdSharedConsumption: %v\n",
|
||||
internal.ToJSON(result.NonProdSharedConsumption.GetResources()))
|
||||
fmt.Printf(" ProdDedicatedConsumption: %v\n",
|
||||
internal.ToJSON(result.ProdDedicatedConsumption.GetResources()))
|
||||
fmt.Printf(" NonProdDedicatedConsumption: %v\n",
|
||||
internal.ToJSON(result.NonProdDedicatedConsumption.GetResources()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ type Job struct {
|
|||
URIs []URI `yaml:"uris"`
|
||||
Metadata map[string]string `yaml:"labels"`
|
||||
Service bool `yaml:"service"`
|
||||
Priority int32 `yaml:"priority"`
|
||||
Thermos []ThermosProcess `yaml:",flow,omitempty"`
|
||||
Container *Container `yaml:"container,omitempty"`
|
||||
CronSchedule *string `yaml:"cronSchedule,omitempty"`
|
||||
|
@ -88,6 +89,7 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) {
|
|||
RAM(j.RAM).
|
||||
Disk(j.Disk).
|
||||
IsService(j.Service).
|
||||
Priority(j.Priority).
|
||||
InstanceCount(j.Instances).
|
||||
MaxFailure(j.MaxFailures)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue