You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by "Ganelin, Ilya" <Il...@capitalone.com> on 2017/03/01 17:23:06 UTC
Local mode execution
Hi all, I’ve returned to writing Apex apps after a hiatus, it seems that the LocalMode is now deprecated, having been replaced by the Launcher interface. Is there an example or documentation anywhere of using this new API?
Please let me know, thanks!
- Ilya Ganelin
[id:image001.png@01D1F7A4.F3D42980]
________________________________________________________
The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
Re: Local mode execution
Posted by Thomas Weise <th...@apache.org>.
Malhar has not been updated to use the later version of core, so that's why
you don't find examples there. It is used in the ApexRunner in Beam though.
Here is a code snippet from a test I wrote recently that uses the new API:
EmbeddedAppLauncher<?> launcher = Launcher.getLauncher(LaunchMode.
EMBEDDED);
Attribute.AttributeMap launchAttributes = new Attribute.AttributeMap.
DefaultAttributeMap();
launchAttributes.put(EmbeddedAppLauncher.RUN_ASYNC, true);
Configuration conf = new Configuration(false);
conf.addResource(this.getClass().getResourceAsStream(
"/META-INF/properties.xml"));
conf.addResource(this.getClass().getResourceAsStream(
"/wordcounttest-properties.xml"));
File resultFile = new File("./target/wordcountresult_4.0");
if (resultFile.exists() && !resultFile.delete()) {
throw new AssertionError("Failed to delete " + resultFile);
}
AppHandle appHandle = launcher.launchApp(new Application(), conf,
launchAttributes);
long timeoutMillis = System.currentTimeMillis() + 10000;
while (!appHandle.isFinished() && System.currentTimeMillis() <
timeoutMillis) {
Thread.sleep(500);
if (resultFile.exists() && resultFile.length() > 0) {
break;
}
}
appHandle.shutdown(ShutdownMode.KILL);
Assert.assertTrue(resultFile.exists() && resultFile.length() > 0);
String result = FileUtils.readFileToString(resultFile);
Assert.assertTrue(result, result.contains("MyFirstApplication=5"));
On Wed, Mar 1, 2017 at 9:23 AM, Ganelin, Ilya <Il...@capitalone.com>
wrote:
> Hi all, I’ve returned to writing Apex apps after a hiatus, it seems that
> the LocalMode is now deprecated, having been replaced by the Launcher
> interface. Is there an example or documentation anywhere of using this new
> API?
>
>
>
> Please let me know, thanks!
>
>
>
> - Ilya Ganelin
>
> [image: id:image001.png@01D1F7A4.F3D42980]
>
> ------------------------------
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>
Re: Local mode execution
Posted by "Ganelin, Ilya" <Il...@capitalone.com>.
Apologies – I missed his response due to an email filter. Found it now, thanks!
- Ilya Ganelin
On 3/3/17, 9:19 AM, "Munagala Ramanath" <ra...@datatorrent.com> wrote:
There was a response from Thomas 2 days ago which also included a code
fragment.
Let me know if you are unable to locate it and I'll copy it here.
Ram
On Fri, Mar 3, 2017 at 9:10 AM, Ganelin, Ilya <Il...@capitalone.com>
wrote:
> Hey all - any word on this? Would love to be able to test locally using
> the new framework. Thanks!
>
>
>
>
> ________________________________
> From: Ganelin, Ilya <Il...@capitalone.com>
> Sent: Wednesday, March 1, 2017 12:23:06 PM
> To: dev@apex.apache.org
> Subject: Local mode execution
>
> Hi all, I’ve returned to writing Apex apps after a hiatus, it seems that
> the LocalMode is now deprecated, having been replaced by the Launcher
> interface. Is there an example or documentation anywhere of using this new
> API?
>
> Please let me know, thanks!
>
> - Ilya Ganelin
> [id:image001.png@01D1F7A4.F3D42980]
>
> ________________________________
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
> ________________________________________________________
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>
--
_______________________________________________________
Munagala V. Ramanath
Software Engineer
E: ram@datatorrent.com | M: (408) 331-5034 | Twitter: @UnknownRam
www.datatorrent.com | apex.apache.org
________________________________________________________
The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
Re: Local mode execution
Posted by Munagala Ramanath <ra...@datatorrent.com>.
There was a response from Thomas 2 days ago which also included a code
fragment.
Let me know if you are unable to locate it and I'll copy it here.
Ram
On Fri, Mar 3, 2017 at 9:10 AM, Ganelin, Ilya <Il...@capitalone.com>
wrote:
> Hey all - any word on this? Would love to be able to test locally using
> the new framework. Thanks!
>
>
>
>
> ________________________________
> From: Ganelin, Ilya <Il...@capitalone.com>
> Sent: Wednesday, March 1, 2017 12:23:06 PM
> To: dev@apex.apache.org
> Subject: Local mode execution
>
> Hi all, I’ve returned to writing Apex apps after a hiatus, it seems that
> the LocalMode is now deprecated, having been replaced by the Launcher
> interface. Is there an example or documentation anywhere of using this new
> API?
>
> Please let me know, thanks!
>
> - Ilya Ganelin
> [id:image001.png@01D1F7A4.F3D42980]
>
> ________________________________
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
> ________________________________________________________
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>
--
_______________________________________________________
Munagala V. Ramanath
Software Engineer
E: ram@datatorrent.com | M: (408) 331-5034 | Twitter: @UnknownRam
www.datatorrent.com | apex.apache.org
RE: Local mode execution
Posted by "Ganelin, Ilya" <Il...@capitalone.com>.
Hey all - any word on this? Would love to be able to test locally using the new framework. Thanks!
________________________________
From: Ganelin, Ilya <Il...@capitalone.com>
Sent: Wednesday, March 1, 2017 12:23:06 PM
To: dev@apex.apache.org
Subject: Local mode execution
Hi all, I’ve returned to writing Apex apps after a hiatus, it seems that the LocalMode is now deprecated, having been replaced by the Launcher interface. Is there an example or documentation anywhere of using this new API?
Please let me know, thanks!
- Ilya Ganelin
[id:image001.png@01D1F7A4.F3D42980]
________________________________
The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
________________________________________________________
The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.