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

Respawn all option #8

Merged
merged 10 commits into from
Mar 11, 2020
Merged

Respawn all option #8

merged 10 commits into from
Mar 11, 2020

Conversation

lindawang-6
Copy link

https://www.wrike.com/open.htm?id=450858821
Option is set with command line flags. If respawn all is set to false but the node's respawn is set to true in launch file, will still set respawn to true. I can change that though.
Also @gauthamm I'm unsure how to implement this with sootballs? Should I do it in apis.py? Or somewhere else?

@lindawang-6 lindawang-6 requested review from gajena and gauthamm March 3, 2020 06:34
@@ -276,7 +281,7 @@ void LaunchConfig::parseNode(TiXmlElement* element, ParseContext ctx)
const char* type = element->Attribute("type");
const char* args = element->Attribute("args");
const char* ns = element->Attribute("ns");
const char* respawn = element->Attribute("respawn");
const char* respawn = element->Attribute("respawn");
Copy link

Choose a reason for hiding this comment

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

this repo uses tabs instead of spaces, please use tabs for this external repo to preserve formatting

@@ -75,6 +75,9 @@ void usage()
" Use GROUP as name of the launch group. By default, empty\n"
" --launch-config=CONFIG\n"
" Use CONFIG as name of the launch config. By default, empty\n"
" --respawn-all=BOOL\n"
Copy link

Choose a reason for hiding this comment

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

can you do this similar to xqms#109,
basically have `--respawn-attr="obey|force_true|force_false"

@gauthamm
Copy link

gauthamm commented Mar 3, 2020

@@ -75,6 +75,9 @@ void usage()
" Use GROUP as name of the launch group. By default, empty\n"
" --launch-config=CONFIG\n"
" Use CONFIG as name of the launch config. By default, empty\n"
" --respawn-attr=force_true|force_false\n"
Copy link

Choose a reason for hiding this comment

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

as mentioned before lets keep an option to obey the respawn rules mentioned in launch file which will be default.

@@ -75,6 +75,9 @@ void usage()
" Use GROUP as name of the launch group. By default, empty\n"
" --launch-config=CONFIG\n"
" Use CONFIG as name of the launch config. By default, empty\n"
" --respawn-attr=force_true|force_false\n"
Copy link

Choose a reason for hiding this comment

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

please check formatting in the file, replace space indentation with tabs. The simplest way to make sure is to view spaces in IDE (https://stackoverflow.com/questions/30140595/show-whitespace-characters-in-visual-studio-code) and replace spaces with tabs (copy from another part part of file)

@@ -133,6 +136,7 @@ static const struct option OPTIONS[] = {
{"robot", required_argument, nullptr, 'r'},
{"launch-group", required_argument, nullptr, 'g'},
{"launch-config", required_argument, nullptr, 'z'},
{"respawn-all", required_argument, nullptr, 'R'},
Copy link

Choose a reason for hiding this comment

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

does not match the help script from above now

{
node->setRespawn(ctx.parseBool(respawn, element->Row()));
node->setRespawn(m_respawnAll || ctx.parseBool(respawn, element->Row()));
Copy link

Choose a reason for hiding this comment

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

force_false should override respawn to false. I suggest keeping two parameters m_respawnObey and m_respawnAll.

if (m_respawnObey) {
        node->setRespawn(ctx.parseBool(respawn, element->Row()));
} else {
         node->setRespawn(m_respawnAll);
}

@lindawang-6
Copy link
Author

Sorry I still need to cleanup the indenting for this more @gauthamm

@gajena
Copy link

gajena commented Mar 6, 2020

Also, check the Travis for changes in the test.


if(respawnDelay)
}
else
Copy link

Choose a reason for hiding this comment

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

else if (!m_respawnObey)

node->setRespawn(m_respawnAll);
}

if(((m_respawnObey && respawn && ctx.parseBool(respawn, element->Row())) || m_respawnAll) && respawnDelay)
Copy link

Choose a reason for hiding this comment

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

I think instead of complicated chain of conditions here, the only change needed in this function would be to swap the following in original implementation

if (respawn)
{
    node->setRespawn(ctx.parseBool(respawn, element->Row()));

with

if ((m_respawnObey && respawn) || !m_respawnObey)
{
   if (!m_respawnObey) {
        node->setRespawn(m_respawnAll);
    } else {
        node->setRespawn(ctx.parseBool(respawn, element->Row()));
    }

Copy link
Author

Choose a reason for hiding this comment

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

I don't think this would work because then respawn delay will be set even if m_respawnAll is set to false.

else
{
node->setRespawn(ctx.parseBool(respawn, element->Row()));
}
if(respawnDelay)

Choose a reason for hiding this comment

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

I assume you verified this is not an issue?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, respawndelay is only used if respawn is set.

@lindawang-6 lindawang-6 merged commit 8faf10a into rr-devel Mar 11, 2020
@lindawang-6 lindawang-6 deleted the feature/lw-respawn-all branch March 11, 2020 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants