[
https://issues.apache.org/jira/browse/BEAM-13124?focusedWorklogId=700496&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-700496
]
ASF GitHub Bot logged work on BEAM-13124:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Dec/21 10:43
Start Date: 23/Dec/21 10:43
Worklog Time Spent: 10m
Work Description: AydarZaynutdinov commented on a change in pull request
#16277:
URL: https://github.com/apache/beam/pull/16277#discussion_r774482879
##########
File path: playground/backend/internal/utils/system_utils.go
##########
@@ -16,14 +16,59 @@
package utils
import (
+ "beam.apache.org/playground/backend/internal/environment"
+ "beam.apache.org/playground/backend/internal/logger"
+ "net/http"
+ "os"
+ "path/filepath"
"reflect"
"runtime"
"strings"
)
+const (
+ executableFiles = "executable_files"
+)
+
// GetFuncName returns the name of the received func
func GetFuncName(i interface{}) string {
fullName := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
splitName := strings.Split(fullName, ".")
return splitName[len(splitName)-1]
}
+
+// GetReadinessFunction returns the function that checks the readiness of the
server to process a new code processing request
+func GetReadinessFunction(envs *environment.Environment) func(writer
http.ResponseWriter, request *http.Request) {
+ return func(writer http.ResponseWriter, request *http.Request) {
+ if checkNumOfTheParallelJobs(envs.ApplicationEnvs.WorkingDir(),
envs.BeamSdkEnvs.NumOfParallelJobs()) {
+ writer.WriteHeader(http.StatusOK)
+ } else {
+ writer.WriteHeader(http.StatusLocked)
+ }
+ }
+}
+
+// checkNumOfTheParallelJobs checks the number of already working code
processing.
Review comment:
Done.
##########
File path: playground/backend/internal/environment/beam.go
##########
@@ -42,17 +42,23 @@ func NewExecutorConfig(compileCmd, runCmd, testCmd string,
compileArgs, runArgs,
// BeamEnvs contains all environments related of ApacheBeam. These will use to
run pipelines
type BeamEnvs struct {
- ApacheBeamSdk pb.Sdk
- ExecutorConfig *ExecutorConfig
- preparedModDir string
+ ApacheBeamSdk pb.Sdk
+ ExecutorConfig *ExecutorConfig
+ preparedModDir string
+ numOfParallelJobs int
}
// NewBeamEnvs is a BeamEnvs constructor
-func NewBeamEnvs(apacheBeamSdk pb.Sdk, executorConfig *ExecutorConfig,
preparedModDir string) *BeamEnvs {
- return &BeamEnvs{ApacheBeamSdk: apacheBeamSdk, ExecutorConfig:
executorConfig, preparedModDir: preparedModDir}
+func NewBeamEnvs(apacheBeamSdk pb.Sdk, executorConfig *ExecutorConfig,
preparedModDir string, numOfParallelJobs int) *BeamEnvs {
+ return &BeamEnvs{ApacheBeamSdk: apacheBeamSdk, ExecutorConfig:
executorConfig, preparedModDir: preparedModDir, numOfParallelJobs:
numOfParallelJobs}
}
// PreparedModDir returns the path to the directory where prepared go.mod and
go.sum are located
func (b *BeamEnvs) PreparedModDir() string {
return b.preparedModDir
}
+
+// NumOfParallelJobs returns the max number of the possible code processing
for the SDK on that instance at the same time
Review comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 700496)
Time Spent: 3h 10m (was: 3h)
> [Playground] Create readiness endpoint
> --------------------------------------
>
> Key: BEAM-13124
> URL: https://issues.apache.org/jira/browse/BEAM-13124
> Project: Beam
> Issue Type: New Feature
> Components: beam-playground
> Reporter: Artur Khanin
> Assignee: Aydar Zaynutdinov
> Priority: P3
> Labels: beam-playground-backend, beam-playground-beta-launch,
> beam-playground-sprint-5
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> Need to add a new endpoint to check the instance's readiness. If the instance
> is ready to receive one more code to process it this endpoint should return
> status 200, in another case, it returns some error status (423 for example).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)