-
Notifications
You must be signed in to change notification settings - Fork 9
The Crawler now registers itself at the instance registry #24
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
Conversation
Initial functionality to verify the instance registry is available on startup
Changed infrastructure of Configuration to support the IR concept.
Still yields runtime exception, dependency 'spray-client' is no compatible with scala 2.12 . For scala 2.12 it it contents are part of akka-http-core, this needs to be upgraded.
Code Cleanup, API extensions
…h instance in the configuration.
…tdown / exception during preflight checks.
…gistry # Conflicts: # build.sbt # src/main/scala/de/upb/cs/swt/delphi/crawler/storage/ElasticReachablePreflightCheck.scala
Codecov Report
@@ Coverage Diff @@
## develop #24 +/- ##
==========================================
- Coverage 8.22% 7.33% -0.89%
==========================================
Files 36 38 +2
Lines 888 995 +107
Branches 12 23 +11
==========================================
Hits 73 73
- Misses 815 922 +107
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review the comments. There might be some issues (or not... I might be wrong).
|
||
lazy val elasticsearchClientUri: ElasticsearchClientUri = ElasticsearchClientUri({ | ||
if(elasticsearchInstance.portnumber.isEmpty){ | ||
elasticsearchInstance.iP.getOrElse("elasticsearch://localhost:" + defaultElasticSearchPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is localhost hard coded here?
At first glance this looks a bit strange.
if(elasticsearchInstance.portnumber.isEmpty){ | ||
elasticsearchInstance.iP.getOrElse("elasticsearch://localhost:" + defaultElasticSearchPort) | ||
}else{ | ||
elasticsearchInstance.iP.getOrElse("elasticsearch://localhost") + ":" + elasticsearchInstance.portnumber.getOrElse(defaultElasticSearchPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
case Success(instance) => instance | ||
case Failure(_) => Instance( | ||
None, | ||
Some(sys.env.getOrElse("DELPHI_ELASTIC_URI","elasticsearch://localhost")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original code there was a port given. Does it work without giving it the default port?
src/main/scala/de/upb/cs/swt/delphi/crawler/io/swagger/client/model/Instance.scala
Show resolved
Hide resolved
Success(configuration) | ||
} | ||
} recover { case e => | ||
if(configuration.usingInstanceRegistry) InstanceRegistry.sendMatchingResult(isElasticSearchReachable = false, configuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the condition at all places where it is used can be dangerous.
Could we always make the call and decide this in the method? (or through inheritance)
src/main/scala/de/upb/cs/swt/delphi/crawler/instancemanagement/InstanceRegistry.scala
Outdated
Show resolved
Hide resolved
build.sbt
Outdated
@@ -70,6 +73,7 @@ libraryDependencies ++= Seq( | |||
) | |||
|
|||
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" | |||
resolvers ++= Seq(Resolver.mavenLocal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this local resolver?
The configuration file has been extended to now contain an attribute "InstanceRegistryUri". The crawler tries to connect to this URI on startup. If successful, it registers itself at the Instance Registry, retrieves an ElasticSearch instance from there and uses it instead of the default one specified in the config, and deregisters on error / shutdown.
If the crawler cannot connect to the Instance Registry, it will print a warning and continue the execution by using the default ElasticSearch instance specified in the config.
This addresses issue #21 .
Note: The loading of the configuration file "Hermes.conf" in HermesAnalyzer.scala line 101 using the ClassLoader failed for me both on Linux and Windows. The Hermes implementation reported an error that the configuration file "cannot be found or read".