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

Added sequence join wait command #1084

Merged
merged 5 commits into from
Nov 16, 2021
Merged

Added sequence join wait command #1084

merged 5 commits into from
Nov 16, 2021

Conversation

saba-ja
Copy link
Contributor

@saba-ja saba-ja commented Oct 22, 2021

Originating Project/Creator F Prime
Affected Component CmdSequencer
Affected Architectures(s) Svc
Related Issue(s) NA
Has Unit Tests (y/n) Y
Builds Without Errors (y/n) Y
Unit Tests Pass (y/n) Y
Documentation Included (y/n) N

Change Description

Background:
F Prime CmdSequncer allows nested sequence engine calls. (e.g. seqEng_Primary can execute a sequence file that contains seqEng_Secondary which executes a different sequence files)

This PR allows user to run multiple sequence engines in parallel and wait for them to complete before continue executing the rest of the requests from the same sequence engines.

Rationale

Use case example:

Assume we have the following sequence file, seq_file_1.seq, that contains two different sequence engine, seqEng_Secondary_A and seqEng_Secondary_B, that execute seq_file_2.bin and seq_file_3.bin:

seq_file_1.seq

seqEng_Secondary_A.CS_RUN "seq_file_2.bin" SEQ_NO_BLOCK;
seqEng_Secondary_B.CS_RUN "seq_file_3.bin" SEQ_NO_BLOCK;
seqEng_Secondary_A.JOIN_WAIT; 
seqEng_Secondary_B.JOIN_WAIT; 
seqEng_Secondary_A.CS_RUN "seq_file_2.bin" SEQ_NO_BLOCK;

If the user run the above sequence file with the following command:

seqEng_Primary.CS_RUN "seq_file_1.bin" SEQ_NO_BLOCK;

seqEng_Secondary_A and seqEng_Secondary_B will run simultaneously, and the process will wait for them to complete before executing the next seqEng_Secondary_A request.

Without the join_wait command the last request will be dropped with a warning_hi EXECUTION_ERR if the first request is still in progress.

Testing/Review Recommendations

Created UT and manually checked the behavior of running multiple seq engines with and without join_wait command:

Running multiple seq engines without join_wait:
https://youtu.be/DBR2DKnVZbU

Running multiple seq engines with join_wait:
https://youtu.be/eaCFJH6IN-s

Future Work

NA

@github-actions
Copy link

github-actions bot commented Oct 22, 2021

@check-spelling-bot Report

Unrecognized words, please review:

  • JOINWAIT
Previously acknowledged words that are now absent differend FIXME followd lgcov lxr setname setopt
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:saba-ja/fprime.git repository
on the add_seq_join_wait branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/nasa/fprime/issues/comments/949371644" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

@LeStarch LeStarch self-requested a review November 2, 2021 22:45
@saba-ja
Copy link
Contributor Author

saba-ja commented Nov 12, 2021

Verify the behavior of join_wait when a cmd fails.

In this test two sequence engines are running in parallel and we have executed join_wait cmd for each seq engine.
When one of the cmds in seq_1 fails the seq_1 engine will stop executing the rest of the commands in seq_1 file and stops join_waiting. The seq_2 engine will not be affected and will execute its commands. The behavior is shown in the following video:

IMAGE ALT TEXT HERE

@saba-ja
Copy link
Contributor Author

saba-ja commented Nov 12, 2021

@LeStarch, this is ready for review.

@LeStarch
Copy link
Collaborator

Looks good!

@LeStarch LeStarch merged commit 5ff671d into nasa:devel Nov 16, 2021
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.

2 participants