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

HPCC-13036 Add support for embed activities #11042

Merged
merged 1 commit into from May 2, 2018

Conversation

ghalliday
Copy link
Member

@ghalliday ghalliday commented Apr 18, 2018

Signed-off-by: Gavin Halliday gavin.halliday@lexisnexis.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Testing:

@hpcc-jirabot
Copy link

@ghalliday
Copy link
Member Author

@jakesmith @richardkchapman please review.
See also HPCC-19493 for issues relating to coding activities in python etc.

@richardkchapman
Copy link
Member

@ghalliday Why the failures?

@ghalliday
Copy link
Member Author

@AttilaVamos It wasn't very obvious from the smoke test results that I forgot to check in the key files.
@richardkchapman try again.

@AttilaVamos
Copy link
Contributor

@ghalliday It is a bug in Regression Test Engine. I raised a JIRA to fix it.

@ghalliday
Copy link
Member Author

@jakesmith @richardkchapman for review

@@ -790,6 +790,7 @@ const char * cppSystemText[] = {
" boolean newMemorySpillSplitArg(unsigned4 usageCount, const varstring name, boolean meta) : include, pseudoentrypoint='new CLibraryMemorySpillSplitArg';",
" boolean newWorkUnitReadArg(const varstring _name, boolean _meta) : include, pseudoentrypoint='new CLibraryWorkUnitReadArg';",
" boolean newWorkUnitWriteArg(const varstring _name, unsigned4 _flags, boolean _meta) : include, pseudoentrypoint='new CLibraryWorkUnitWriteArg';",
" CThorExternalArg(unsigned4 _numInputs) : include;",
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this line

Copy link
Member

Choose a reason for hiding this comment

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

nor do I. Is it for a forward declaration?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is the declaration of the constructor for the helper class - so it can be called as a fake external function.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a comment?

virtual unsigned queryStrand() const = 0; // 0 based 0..numStrands-1
};

//MORE: How does is this extended to support onStart/onCReate
Copy link
Member

Choose a reason for hiding this comment

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

typo onCReate

@richardkchapman
Copy link
Member

Minor comments - but not sure I would have spotted anything.

@jakesmith

@@ -790,6 +790,7 @@ const char * cppSystemText[] = {
" boolean newMemorySpillSplitArg(unsigned4 usageCount, const varstring name, boolean meta) : include, pseudoentrypoint='new CLibraryMemorySpillSplitArg';",
" boolean newWorkUnitReadArg(const varstring _name, boolean _meta) : include, pseudoentrypoint='new CLibraryWorkUnitReadArg';",
" boolean newWorkUnitWriteArg(const varstring _name, unsigned4 _flags, boolean _meta) : include, pseudoentrypoint='new CLibraryWorkUnitWriteArg';",
" CThorExternalArg(unsigned4 _numInputs) : include;",
Copy link
Member

Choose a reason for hiding this comment

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

nor do I. Is it for a forward declaration?

virtual unsigned numSlaves() const { return 1; }
virtual unsigned numStrands() const { return strands; }
virtual unsigned querySlave() const { return 0; }
virtual unsigned queryStrand() const { return curStrand; }
Copy link
Member

Choose a reason for hiding this comment

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

above method could have 'override'

}
RTLIMPLEMENT_IINTERFACE

virtual const void *nextRow()
Copy link
Member

Choose a reason for hiding this comment

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

could have override

memcpy(row+sizeof(__uint64)+sizeof(size32_t), name, lenName);
return rowBuilder.finalizeRowClear(len);
}
virtual void stop()
Copy link
Member

Choose a reason for hiding this comment

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

could have override

virtual unsigned numSlaves() const { return 1; }
virtual unsigned numStrands() const { return strands; }
virtual unsigned querySlave() const { return 0; }
virtual unsigned queryStrand() const { return curStrand; }
Copy link
Member

Choose a reason for hiding this comment

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

above could be declared with 'override'

// ExternalSlaveActivity
//

class NodeActivityContext : public IThorActivityContext
Copy link
Member

Choose a reason for hiding this comment

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

We should agree and try to be consistent, and I don't mind changing style, but all Thor classes begin with C, so e.g. CNodeActivityContext

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 will change.
I think I use CX for a class that is the only concrete implementation of an interface. If there is more than one, then I often don't have a C prefix.

virtual unsigned numSlaves() const { return slaves; }
virtual unsigned numStrands() const { return 1; }
virtual unsigned querySlave() const { return curSlave; }
virtual unsigned queryStrand() const { return 0; }
Copy link
Member

Choose a reason for hiding this comment

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

above could be 'override'

virtual void process() override
{
start();
processed = 0;
Copy link
Member

Choose a reason for hiding this comment

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

no point in this line

@@ -0,0 +1,34 @@
/*##############################################################################

HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
Copy link
Member

Choose a reason for hiding this comment

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

2018



activityslaves_decl CActivityBase *createExternalSlave(CGraphElementBase *container);
activityslaves_decl CActivityBase *createExternalSinkSlave(CGraphElementBase *container);
Copy link
Member

Choose a reason for hiding this comment

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

because no one likes .ipp's and only here to include these factory methods and these are internal to this dll (activityslaves), I tend not to add a activity .ipp for activities and instead these declarations appear near top of slave.cpp (around line 244 onward)

@jakesmith
Copy link
Member

@ghalliday - some minor comments.

@ghalliday
Copy link
Member Author

@jakesmith please check revisions.

bool local;
};

class ExternalSlaveActivity : public CSlaveActivity
Copy link
Member

Choose a reason for hiding this comment

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

picky: you changed NodeActivityContext to CNodeActivityContext, would be good to change this and ExternalSinkSlaveActivity further down.

@jakesmith
Copy link
Member

@ghalliday - 1 picky comment, but otherwise looks good.

@ghalliday
Copy link
Member Author

@jakesmith renamed class and squashed.

@jakesmith
Copy link
Member

@ghalliday - Looks good to merge

if (callIsActivity(expr))
{
//Can only be deduced by substituting the parameters into the body and seeing if the local attribute has a constant value
//currently assume false.
Copy link
Member

Choose a reason for hiding this comment

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

Is this something that needs improving?

@@ -8079,6 +8079,8 @@ class Vs6CppNameMangler
mangled.append("PVIGlobalCodeContext@@");
else if (body->hasAttribute(userMatchFunctionAtom))
mangled.append("PVIMatchWalker@@");
if (functionBodyIsActivity(body))
Copy link
Member

Choose a reason for hiding this comment

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

Not familiar with the mangling schemes, but is it correct that this one is an if while the others are "else if" ?

Copy link
Member Author

@ghalliday ghalliday Apr 30, 2018

Choose a reason for hiding this comment

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

Because the others seem to be exclusive options - e.g., see generateFunctionPrototype(). I was missing an entry for gcc name mangling.

if (!implementationClassName && constructorArgs)
{
StringBuffer baseClassName;
baseClassName.append("CThor").append(activityArgName).append("Arg");
Copy link
Member

Choose a reason for hiding this comment

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

Is this calling the constructor mentioned in comments above? If so not sure how it would work unless activityArgName was "External".

Copy link
Member Author

Choose a reason for hiding this comment

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

It would only work if an entry was added for any other based class that required it.

if (value->isConstant())
instance->isLocal = getBoolValue(value, false);
else
reportError(queryLocation(expr), ECODETEXT(HQLERR_AttributeXMustBeConstant), "LOCAL");
Copy link
Member

Choose a reason for hiding this comment

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

Should this be done in the semantic check phase?

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 have moved it, although I'm not convinced it is better.

@richardkchapman
Copy link
Member

@ghalliday Some questions. And you don't seem to have addressed Jake's comment about an incorrect copyright date.

@ghalliday
Copy link
Member Author

@richardkchapman see changes.

@ghalliday ghalliday force-pushed the issue13036 branch 2 times, most recently from 854299f to b66afcb Compare April 30, 2018 10:23
@richardkchapman
Copy link
Member

@ghalliday Do you know why failing?

@ghalliday
Copy link
Member Author

@AttilaVamos I think this is smoke test failure. The branch runs fine on my machine.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
HqlExprArray actuals;
ForEachChild(i, formals)
{
if (i < bound.ordinality())
Copy link
Contributor

Choose a reason for hiding this comment

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

@ghalliday Would this work as expected in the case where the dataset input was not first? Something like the following:
test(boolean testValue, streamed dataset(r) ds)

Copy link
Member Author

Choose a reason for hiding this comment

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

It works as expected - only leading streamed datasets are treated as input activities.
That should be documented - I added a comment on the documentation jira.

@HPCCSmoketest
Copy link
Contributor

Automated Smoketest: ✅
OS: centos 7.2.1511 (Linux 3.10.0-327.28.3.el7.x86_64)
Sha: c0d0e2f
Build: success
Install hpccsystems-platform-community_6.5.0-trunk0.el7.x86_64.rpm
HPCC Start: OK

Unit tests result:

Test total passed failed errors timeout
unittest 88 88 0 0 0
wutoolTest(Dali) 19 19 0 0 0
wutoolTest(Cassandra) 19 19 0 0 0

Regression test result:

phase total pass fail
setup (hthor) 11 11 0
setup (thor) 11 11 0
setup (roxie) 11 11 0
test (hthor) 780 780 0
test (thor) 711 711 0
test (roxie) 824 824 0

HPCC Stop: OK
HPCC Uninstall: OK
Time stats:

Prep time Build time Package time Install time Start time Test time Stop time Summary
35 sec (00:00:35) 185 sec (00:03:05) 56 sec (00:00:56) 6 sec (00:00:06) 21 sec (00:00:21) 1183 sec (00:19:43) 16 sec (00:00:16) 1502 sec (00:25:02)

@richardkchapman richardkchapman merged commit 8038bba into hpcc-systems:master May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants