Skip to content

Conversation

@AlexRast
Copy link
Collaborator

This adds the NameServer process and makes the Mothership inherit from SBase. Now that Mothership officially inherits from its expected base classes, its class files are given the 'proper' Mothership.h and Mothership.cpp names. I think Ns_el.h and Ns_el.cpp are probably not needed but I have not changed them and so far everything seems to work - tested with some small working examples using both default and application supervisors from heat plate and clock tree, and with some larger (multi-board) examples as well.
There is a MothershipDummy class to aid in testing of the NameServer without the full mothership; it can probably eventually be dropped but might still come in handy when testing UserIO in future.
I have added a few output messages when loading cores just to give the operator some sense of progress - note how SLOW these are to remind everyone of how valuable a thread safe multi-core/multi-board loader would be!
I have manually merged non-conflicting updates to other files from the development branch so although it may show as being any number of commits behind (reflecting the point when the branch was created!) in fact most of the actual files should be up-to-date; of course with significant changes to nameserver, mothership and several related files including the PMsg_p and CMsg_p classes.
For now the group of name services that can inject packets into a Tinsel core directly based upon a device name is not implemented, pending implementation of UserIO. But most of the rest of the name services commands are implemented and tested.

@mvousden
Copy link
Contributor

mvousden commented Sep 26, 2019

Can we merge development into nameserver, so that the review only displays the changes you've made (as opposed all the changes that have been made since ca8bbaf)? i.e.:

git pull
git checkout nameserver
git merge development
... # resolve merge conflicts, potentially with some help
... # resolve changes introduced from renaming TMoth.{h,cpp} -> Mothership.{h,cpp}, potentially with some help
git commit
git push

If you're not confortable to do this, we can do this together, or explore other avenues. As it stands, it's difficult for me (as a reviewer) to see only the changes that you have introduced.

I'm around this afternoon (from about 1530).

@heliosfa
Copy link
Contributor

heliosfa commented Sep 26, 2019

Just to echo what Mark said, this need to have Development merged in properly (rather than manually) before it can be merged back into development.

It is incredibly bad practice to review and/or merge when there are conflicting files - the merge should be a clean one.

@AlexRast
Copy link
Collaborator Author

As seen (3 commits later...) this should fix everything.

Copy link
Contributor

@mvousden mvousden left a comment

Choose a reason for hiding this comment

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

Thanks for opening the PR. I appreciate the comments and line-splitting you've added to Mothership, and the progress you've introduced towards external device support.

Points:

  • Issues labelled with sweet potatoes (:sweet_potato:) are issues that I would not be comfortable with keeping in the source - to get my approval, address the issue, or convince me that it's not a problem.

  • I remember that you had some documentation for the Mothership floating about; has it been updated with these changes? Either way, could you point me to it?

  • As a general rule, please keep code repetition to a minimum. There's a lot of copy-paste.

  • You mention you've tested these changes. Can you elaborate on how exactly you've tested it? Have you tried running the Nameserver on a different box? Presumably you have some check that involves loading an application and dumping the state - if so, can you share your script?

  • You say "Tested with some small working examples using both default and application supervisors from heat plate and clock tree, and with some larger (multi-board) examples as well". This is good - @heliosfa and I test our changes with some iteration of the heated plate example. Could you upload the XMLs you've tested with? If too large, could you dropoff/safesend it to @heliosfa and myself?

  • You say "I think Ns_el.h and Ns_el.cpp are probably not needed but I have not changed them and so far everything seems to work". Can you remove these? It's important not to have unused source files in the tree, because it only leads to confusion about what is in use, and what isn't.

  • When I compile these changes, I get some warnings (
    warnings.txt). Please address these (they all look largely trivial). 🍠

Again, thanks for your work, looking forward to your response.


# Path to the root directory of the Orchestrator (not to be confused with the
# root process of the Orchestrator).
ROOT_DIR = ../..
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a duplicate definition - it's already defined in Makefile.dependencies included in L23. 🍠

$(SOURCE_DIR)/NameServer/ABRecord.cpp \
$(SOURCE_DIR)/NameServer/ABTask.cpp \
$(SOURCE_DIR)/NameServer/AddressBook.cpp \
$(SOURCE_DIR)/NameServer/SBase.cpp \
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation miss here, and in a couple of other places in this file (the lines are justified using spaces, not tabulator characters; we should be consistent) 🍠

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hate tabs. I hate the person who thought of the concept of a tab character. Whoever it was (probably someone at IBM), they should have been forced to use EBCDIC coding for the rest of their life. I also hate editors that automatically insert tabs. Did I say I hate tabs?...

Copy link
Contributor

Choose a reason for hiding this comment

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

Add:

(setq-default indent-tabs-mode nil)                                            |
(setq-default tab-width 4)

to your .emacs if don't want the tab key to insert tabs in emacs.

$(SOURCE_DIR)/OrchBase/P_addr.cpp

# The LogServer message file is a static text file
LOGSERVER_MESSAGE_FILE_ORIGIN = $(SOURCE_DIR)/OrchestratorMessages.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate definition with L196. 🍠

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This looks like something inserted during the merge. DOes Git do this (interleave files?) From reading the documentation it looked ats if it might, which is why I was very VERY reluctant to do a merge, but it looks also as though it does it so subtly that you can't even do a compare to detect differences. If merges are required, on the one hand, and if merge silently interleaves files on the other, and if it doesn't give you an option that allows you to do a line-by-line approval of the merge as it happens, I don't see how it can be possible to pull a branch back into the main line without creating merge issues.

Copy link
Contributor

@mvousden mvousden Oct 1, 2019

Choose a reason for hiding this comment

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

This additional line was introduced by commit 2bbe0a6, which was before development was merged in:

commit 2bbe0a6f80930a234fa5d7da04153f833dd9cddd
Author: AlexRast <adr1r17@soton.ac.uk>
Date:   Thu Sep 26 14:48:22 2019 +0100

    re-updated makefiles and message file that were somehow reverted in the last commit

Perhaps your issue is with the work prior to this commit.

//==============================================================================
namespace AddressBookNS
{
#ifdef EXCEPTS
Copy link
Contributor

Choose a reason for hiding this comment

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

I've not seen this pattern before! Seems a little odd because you'll need to define X and Y in your source, even if they aren't needed...

Copy link
Contributor

Choose a reason for hiding this comment

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

This was mine when I was considering having throwable exceptions.
I meant to talk to you about your preference - The exceptions really did not work well with Borland (it insisted on stepping down the exception tree) hence the return code option.

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer exceptions for what you're doing here, because chains of break statements can be considerably more difficult to follow, but I'm pretty ambivalent.

I'd rather you choose one or the other for "production" - otherwise this becomes a bit of a Frankenstein amalgam.

#define ERETURN(X, Y) return Y
#endif

// static constant definitions
Copy link
Contributor

Choose a reason for hiding this comment

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

Use an enum.

Copy link
Collaborator Author

@AlexRast AlexRast Sep 30, 2019

Choose a reason for hiding this comment

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

I think this has to do with Graeme's comment above as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mark's comment was in regard to the following list of consts.

Copy link
Contributor

Choose a reason for hiding this comment

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

@heliosfa has it right here.

//Task Manipulation
unsigned AddressBook::AddTask(const std::string &TaskName, TaskData_t &Data)
{
// Check that the task does not already exist.
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, this kind of repetition is fine because the actual check is abstracted into a method - the duplication is as small as it reasonably can be.


private:
TaskMap_t TaskMap;
int TaskCount;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to maintain/update this variable? Surely you can just do TaskMap_t.size().

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Graeme? Does this have an important use? Are you just trying to minimise the calls to the size() function?

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 I was trying to minimise the calls to size() - it is also a good metric to looks for "oopsies" to the data structure.

Copy link
Contributor

Choose a reason for hiding this comment

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

To me, TaskMap holds one record for each task. The number of tasks is small, so surely the code complexity added by "caching" a size() call is not worth just calling size() on this very small map.

I think you'll introduce more "oopsies" than you'll catch with this extra maintenance :p

@heliosfa
Copy link
Contributor

heliosfa commented Sep 27, 2019

When I compile these changes, I get some warnings (
warnings.txt). Please address these (they all look largely trivial). 🍠

A lot of these warnings look like a reversion of the changes made in #88 to address #31 to suppress warnings (e.g. d9340cc, 1faa0a9 and others look to have been undone)

@AlexRast
Copy link
Collaborator Author

@heliosfa's last comment doesn't seem to have a reply option - but is this something that could have happened because of the merge process? I would not be surprised. I don't remember seeing warnings pre-merge.

@AlexRast
Copy link
Collaborator Author

Some of the warnings look to have been related to merging, others though when I looked through them would clearly have been there anyway. In any case, these are all fixed together with removal of tabs and the makefile stuff.

@AlexRast
Copy link
Collaborator Author

Can I get everyone's acknowledgement that Ns_el.h/Ns_el.cpp are not in use nor intended for some future use? I have kept them in just in case someone screamed 'NOOO, don't delete that, we need it for xxx/I was planning to use it for yyy'.

@heliosfa
Copy link
Contributor

Can I get everyone's acknowledgement that Ns_el.h/Ns_el.cpp are not in use nor intended for some future use? I have kept them in just in case someone screamed 'NOOO, don't delete that, we need it for xxx/I was planning to use it for yyy'.

I believe that you are correct - they are ADB's original pre-implementation

@heliosfa
Copy link
Contributor

@heliosfa's last comment doesn't seem to have a reply option - but is this something that could have happened because of the merge process? I would not be surprised. I don't remember seeing warnings pre-merge.

Depending how the merge was done, potentially.

One of the changes you have merged in is adding -Wall and -Wpedanticto the make file, which turn on more warnings. The head of development builds cleanly with these flags, so any warning have been introduced by your changes/the merge you have done.

@mvousden
Copy link
Contributor

mvousden commented Oct 1, 2019

Can I get everyone's acknowledgement that Ns_el.h/Ns_el.cpp are not in use nor intended for some future use? I have kept them in just in case someone screamed 'NOOO, don't delete that, we need it for xxx/I was planning to use it for yyy'.

Agree, get rid of it (we can always pull it out of the history if it becomes relevant again for some presently unknown reason).

@AlexRast
Copy link
Collaborator Author

AlexRast commented Oct 1, 2019

Yes, I think the -Wpedantic in particular was responsible for a lot of the additional warnings coming up.

@mvousden mvousden self-requested a review October 8, 2019 08:46
Copy link
Contributor

@mvousden mvousden left a comment

Choose a reason for hiding this comment

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

A set of responses and resolutions.

@@ -0,0 +1,52 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue here is with the design of "Decode". One of the core problems is, because it posts, you can't define a stack of decode methods that get called in sequence (this is why logging is tricky to get right - methods like Post result in inherently brittle, nonmodular code, but other solutions are painful too).

I think you're right, let's accept the duplication. Can you please make a note in the comment at the head of the file explaining that this is a near copy-paste of decode (and vice-versa)?

//==============================================================================
namespace AddressBookNS
{
#ifdef EXCEPTS
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer exceptions for what you're doing here, because chains of break statements can be considerably more difficult to follow, but I'm pretty ambivalent.

I'd rather you choose one or the other for "production" - otherwise this becomes a bit of a Frankenstein amalgam.


unsigned Connect (string="");
unsigned OnCfg (PMsg_p *, unsigned);
unsigned OnDump (PMsg_p *, unsigned);
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation

//==============================================================================
unsigned SBase::QueryDevIAll(PMsg_p *msg, unsigned comm)
{
string taskName = msg->Zname(0); // as usual, first static field is the task
Copy link
Contributor

Choose a reason for hiding this comment

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

The whole thing is structured so that many of the fields in the message contain the same information retrieved in the same way.

So why not abstract it? By not abstracting it, you're brittle to any potential change in the structure later.

But I am extracting them in each command-response directly so that when looking through the code you don't have to go hunting through multiple functions for each little bit of extraction

If you read these query methods in sequence, and if you call the same method each time, it's more clear to a reader that you are doing the same thing. The reader looks at the function once (at most) and, if the method is named appropriately, you won't need to look at the definition to understand what it does.

hunting through multiple functions for each little bit of extraction

It's trivial to lookup a method in this way - the call stack here is pretty flat, and the function would be in the same file.

We're still several levels away from "over-atomisation" in my opinion. I argue that since you reduce code size, duplication, and improve clarity and modularity at the cost of one stack level, the tradeoff of abstraction is certainly worth it here.

"In my opinion" being the key clause here.

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.

4 participants