Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: improve consistency #342

Merged
merged 2 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix variable names for consistency
  • Loading branch information
yohamta committed Sep 29, 2022
commit 2c3c86bce7952250a636fd53673ced2c06b46737
12 changes: 6 additions & 6 deletions internal/controller/status_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func NewDAGStatusReader() *DAGStatusReader {
}

// ReadAllStatus reads all DAGStatus
func (dr *DAGStatusReader) ReadAllStatus(DAGsDir string) (dags []*DAGStatus, errs []string, err error) {
dags = []*DAGStatus{}
func (dr *DAGStatusReader) ReadAllStatus(DAGsDir string) (statuses []*DAGStatus, errs []string, err error) {
statuses = []*DAGStatus{}
errs = []string{}
if !utils.FileExists(DAGsDir) {
if err = os.MkdirAll(DAGsDir, 0755); err != nil {
Expand All @@ -54,16 +54,16 @@ func (dr *DAGStatusReader) ReadAllStatus(DAGsDir string) (dags []*DAGStatus, err
utils.LogErr("read DAGs directory", err)
for _, fi := range fis {
if utils.MatchExtension(fi.Name(), dag.EXTENSIONS) {
dag, err := dr.ReadStatus(filepath.Join(DAGsDir, fi.Name()), true)
d, err := dr.ReadStatus(filepath.Join(DAGsDir, fi.Name()), true)
utils.LogErr("read DAG config", err)
if dag != nil {
dags = append(dags, dag)
if d != nil {
statuses = append(statuses, d)
} else {
errs = append(errs, fmt.Sprintf("reading %s failed: %s", fi.Name(), err))
}
}
}
return dags, errs, nil
return statuses, errs, nil
}

// ReadStatus loads DAG from config file.
Expand Down
10 changes: 5 additions & 5 deletions internal/runner/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ func (er *entryReader) Read(now time.Time) ([]*Entry, error) {
}
}

for _, dag := range er.dags {
if er.suspendChecker.IsSuspended(dag) {
for _, d := range er.dags {
if er.suspendChecker.IsSuspended(d) {
continue
}
f(dag, dag.Schedule, EntryTypeStart)
f(dag, dag.StopSchedule, EntryTypeStop)
f(dag, dag.RestartSchedule, EntryTypeRestart)
f(d, d.Schedule, EntryTypeStart)
f(d, d.StopSchedule, EntryTypeStop)
f(d, d.RestartSchedule, EntryTypeRestart)
}

return entries, nil
Expand Down