Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 2/3] controller: change to wait for launching sec
Date: Wed, 20 Feb 2019 17:55:01 +0900	[thread overview]
Message-ID: <1550652902-2632-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1550652902-2632-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

SPP CLI updates list of secondaries after `pri launch` command
immediately. However, secondary is not launched when list is updated
yet.

This update is to add sleep() to wait 0.5 sec before updating. This 0.5
sec is best effort, but should be enough on almost of environment.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/controller/commands/pri.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index 7043c2f..4124a12 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -4,6 +4,7 @@
 from .. import spp_common
 from ..shell_lib import common
 from ..spp_common import logger
+import time
 
 
 class SppPrimary(object):
@@ -19,6 +20,9 @@ class SppPrimary(object):
     # All of primary commands used for validation and completion.
     PRI_CMDS = ['status', 'launch', 'clear']
 
+    # Wait for launched secondary as best effort. 0.5 sec is enough.
+    WAIT_LAUNCH_SEC = 0.5
+
     def __init__(self, spp_ctl_cli):
         self.spp_ctl_cli = spp_ctl_cli
 
@@ -425,6 +429,9 @@ class SppPrimary(object):
         if res is not None:
             error_codes = self.spp_ctl_cli.rest_common_error_codes
             if res.status_code == 204:
+                # Wait for launch sec as best effort
+                time.sleep(self.WAIT_LAUNCH_SEC)
+
                 print('Send request to launch {ptype}:{sid}.'.format(
                     ptype=proc_type, sid=sec_id))
             elif res.status_code in error_codes:
-- 
2.17.1

  parent reply	other threads:[~2019-02-20  8:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  8:54 [spp] [PATCH 0/3] Fix updating status in SPP CLI ogawa.yasufumi
2019-02-20  8:55 ` [spp] [PATCH 1/3] controller: correct status update of processes ogawa.yasufumi
2019-02-20  8:55 ` ogawa.yasufumi [this message]
2019-02-20  8:55 ` [spp] [PATCH 3/3] controller: change wait for launch configurable ogawa.yasufumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550652902-2632-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).