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

Fixes #3946 : add a service to fetch nodes executions and use them for reporting #341

Conversation

ncharles
Copy link
Member

Ust 3945/impl 3946/add repository for execution reports


def findExecutionTimeByNode(
nodeId : NodeId
, beginDate: DateTime
, endDate : Option[DateTime]
) : Seq[DateTime] = {
var query = "select distinct executiontimestamp from ruddersysevents where ruleId = 'hasPolicyServer-root' and component = 'common' and keyValue = 'EndRun' and nodeId = ? and executiontimestamp >= ?"
var query = "select distinct date from reportsexecution where and nodeId = ? and date >= ?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" where and " is legit ?
In any case, perhaps the and is not necessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where and is not legit

, x.endDate
)
)
}.toMap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, if a given ruleId happen several time in the expectedConfigurationReports sequence, you will loose information ( (1,1), (1,2) ).toMap => [(1 -> 2)] )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you can have it only once; there are no duplicate of rules

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed by other mean, the pb is not in rules but in the argument type of the method (seq in place of set). And in fact, there is no real problem, it was more than the refactoring was mixing optimization and algo logic, and Nico found a clean way to refactor again to make the optimization part apparent (so that it is not lost in the futur).

@ncharles
Copy link
Member Author

I've updated the PR with your remarks

fanf added a commit that referenced this pull request Oct 14, 2013
…ry_for_execution_reports

Fixes #3946 : add a service to fetch nodes executions and use them for reporting
@fanf fanf merged commit baffa32 into Normation:master Oct 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants