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

[New Scheduler] Add ActivationService #5070

Merged
merged 7 commits into from
Apr 13, 2021
Merged

Conversation

upgle
Copy link
Member

@upgle upgle commented Feb 19, 2021

Description

ActivationService is a GRPC service implementation for the scheduler that communicates with the container proxy.

Please refer to this document:
https://cwiki.apache.org/confluence/display/OPENWHISK/ActivationServiceImpl

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • Scheduler

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

public class Empty {
// Workaround for this issue https://github.com/akka/akka-grpc/issues/289
// Gradle complains about no java sources.
// Note. Openwhisk is using a lower gradle version, so the latest akka-grpc version cannot be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we fix this? The issue has been fixed

Copy link
Member Author

Choose a reason for hiding this comment

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

I've already tried it, but It requires a higher Gradle version to use the latest akka-grpc.


//#services
service ActivationService {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra lines

import scala.util.Try

class ActivationServiceImpl()(implicit actorSystem: ActorSystem, logging: Logging) extends ActivationService {
implicit val requestTimeout: Timeout = Timeout(50.seconds)
Copy link
Contributor

Choose a reason for hiding this comment

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

should this not be hardcoded?

import scala.util.Try

class ActivationServiceImpl()(implicit actorSystem: ActorSystem, logging: Logging) extends ActivationService {
implicit val requestTimeout: Timeout = Timeout(50.seconds)
Copy link
Contributor

Choose a reason for hiding this comment

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

should this not be hardcoded?

QueuePool.get(MemoryQueueKey(request.invocationNamespace, key)) match {
case Some(queueValue) =>
// enqueue activation message to reschedule
logging.info(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be debug

implicit val ec: ExecutionContextExecutor = actorSystem.dispatcher

override def rescheduleActivation(request: RescheduleRequest): Future[RescheduleResponse] = {
logging.info(this, s"Try to reschedule activation ${request.invocationNamespace} ${request.fqn} ${request.rev}")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be debug statement

Copy link
Member Author

Choose a reason for hiding this comment

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

Rescheduling is a special case that happens very occasionally. I think we can keep this log with the info level.

implicit val serdes = jsonFormat(ActionMismatch.apply _, "actionMisMatch")
}

object QueuePool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this safe as a global static object being accessed from futures?

Copy link
Member Author

Choose a reason for hiding this comment

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

The only field _queuePool(TrieMap[MemoryQueueKey, MemoryQueueValue]) which is included in this object is a thread-safe.


rpc FetchActivation (FetchRequest) returns (FetchResponse) {}

rpc RescheduleActivation (RescheduleRequest) returns (RescheduleResponse) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

For the design document, RescheduleActivation rpc is for rescheduling when the container proxy cannot process messages, can give some example here? i think just describe it is enough.

@codecov-io
Copy link

codecov-io commented Mar 4, 2021

Codecov Report

Merging #5070 (4d9c7c6) into master (4a13303) will decrease coverage by 43.52%.
The diff coverage is 75.82%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #5070       +/-   ##
===========================================
- Coverage   81.95%   38.42%   -43.53%     
===========================================
  Files         210      218        +8     
  Lines       10167    10700      +533     
  Branches      440      450       +10     
===========================================
- Hits         8332     4112     -4220     
- Misses       1835     6588     +4753     
Impacted Files Coverage Δ
.../openwhisk/core/scheduler/queue/QueueManager.scala 56.75% <56.75%> (ø)
...sk/core/scheduler/grpc/ActivationServiceImpl.scala 88.00% <88.00%> (ø)
...ala/org/apache/openwhisk/core/entity/DocInfo.scala 81.81% <100.00%> (-5.28%) ⬇️
...enwhisk/core/entity/FullyQualifiedEntityName.scala 72.97% <100.00%> (-18.46%) ⬇️
...a/org/apache/openwhisk/common/ConfigMapValue.scala 0.00% <0.00%> (-100.00%) ⬇️
.../apache/openwhisk/core/controller/Namespaces.scala 0.00% <0.00%> (-100.00%) ⬇️
...pache/openwhisk/core/controller/CorsSettings.scala 0.00% <0.00%> (-100.00%) ⬇️
...che/openwhisk/core/entitlement/RateThrottler.scala 0.00% <0.00%> (-100.00%) ⬇️
...he/openwhisk/core/entitlement/KindRestrictor.scala 0.00% <0.00%> (-100.00%) ⬇️
...penwhisk/core/database/cosmosdb/CosmosDBUtil.scala 0.00% <0.00%> (-100.00%) ⬇️
... and 149 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a13303...4d9c7c6. Read the comment docs.

@style95
Copy link
Member

style95 commented Mar 18, 2021

Seems there are some formatting errors.

[/home/travis/build/apache/openwhisk/tools/travis/../../core/scheduler/build/generated/source/proto/main/akkaGrpc/org/apache/openwhisk/grpc/ActivationService.scala]:
       1: file does not include required license header.
       9: line has trailing whitespace.
      10: line has trailing whitespace.
      12: line has trailing whitespace.
      13: line has trailing whitespace.
      15: line has trailing whitespace.
      23: line has trailing whitespace.
      25: line has trailing whitespace.
      27: line has trailing whitespace.
      29: line has trailing whitespace.
      31: line has trailing whitespace.
  [/home/travis/build/apache/openwhisk/tools/travis/../../core/scheduler/build/generated/source/proto/main/akkaGrpc/org/apache/openwhisk/grpc/ActivationServiceClient.scala]:
       1: file does not include required license header.
      37: line has trailing whitespace.
      39: line has trailing whitespace.
      41: line has trailing whitespace.
      43: line has trailing whitespace.

@style95 style95 merged commit cd6fded into apache:master Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants