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

[SPARK-5155] [PySpark] [Streaming] Mqtt streaming support in Python #4229

Closed
wants to merge 25 commits into from

Conversation

prabeesh
Copy link
Contributor

Python API for MQTT, with a word count example and Python unit test.

@SparkQA
Copy link

SparkQA commented Jan 27, 2015

Test build #26174 has finished for PR 4229 at commit 58aa907.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class KafkaUtils(object):
    • class MQTTUtils(object):

jlevel = ssc._sc._getJavaStorageLevel(storageLevel)

def getClassByName(name):
return ssc._jvm.org.apache.spark.util.Utils.classForName(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

getClassByName is not used anywhere, please remove it.

@SparkQA
Copy link

SparkQA commented Jan 27, 2015

Test build #26182 has finished for PR 4229 at commit 3b45aca.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class KafkaUtils(object):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Feb 3, 2015

Test build #26663 has finished for PR 4229 at commit 53678ad.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Feb 3, 2015

Test build #26665 has finished for PR 4229 at commit b0f30db.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@prabeesh prabeesh force-pushed the mqtt_python branch 2 times, most recently from baeba95 to 3810c7d Compare February 3, 2015 19:50
@SparkQA
Copy link

SparkQA commented Feb 3, 2015

Test build #26666 has finished for PR 4229 at commit baeba95.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Feb 3, 2015

Test build #26668 has finished for PR 4229 at commit 3810c7d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

Mosquitto (http://mosquitto.org/) is an open source Mqtt Broker
In ubuntu mosquitto can be installed using the command `$ sudo apt-get install mosquitto`
Run Mqtt publisher as
`$ bin/run-example \
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be ran inside of mosquitto, could you mention that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we modify like this ?
Publisher publishes data to mosquitto broker set in local host. Run Mqtt publisher as

Copy link
Contributor

Choose a reason for hiding this comment

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

bin/run-example is also inside spark, I misunderstood that, sorry.

never-mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya it is actually running the Scala publisher inside the Scala streaming word count example

@SparkQA
Copy link

SparkQA commented Feb 5, 2015

Test build #26857 has finished for PR 4229 at commit 713ec66.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@prabeesh
Copy link
Contributor Author

@tdas please review this

@tdas
Copy link
Contributor

tdas commented Feb 23, 2015

Will do as soon as I get some Spark 1.3 release stuff out of the way.

On Fri, Feb 20, 2015 at 10:02 AM, Prabeesh K notifications@github.com
wrote:

@tdas https://github.com/tdas please review this


Reply to this email directly or view it on GitHub
#4229 (comment).

@SparkQA
Copy link

SparkQA commented Mar 27, 2015

Test build #29304 has finished for PR 4229 at commit 713ec66.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Mar 29, 2015

Test build #29366 has finished for PR 4229 at commit 3982069.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):
  • This patch does not change any dependencies.

@SparkQA
Copy link

SparkQA commented Apr 21, 2015

Test build #30666 has finished for PR 4229 at commit 3982069.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):
  • This patch does not change any dependencies.

@SparkQA
Copy link

SparkQA commented Apr 22, 2015

Test build #30752 has finished for PR 4229 at commit 0cdba97.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):
  • This patch does not change any dependencies.

@prabeesh
Copy link
Contributor Author

prabeesh commented Jun 2, 2015

@tdas please take a look

@tdas
Copy link
Contributor

tdas commented Jun 20, 2015

@prabeesh Lets revive this PR.
@zsxwing Since you have already done the Flume Python API in #6830 , could shepherd this PR?

`$ bin/run-example \
org.apache.spark.examples.streaming.MQTTPublisher tcp://localhost:1883 foo`
and then run the example as
`$ bin/spark-submit --driver-class-path external/mqtt-assembly/target/scala-*/\
Copy link
Member

Choose a reason for hiding this comment

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

Could you change --driver-class-path to --jars? It may mislead the user. MQTT libraries should be put both in the driver and executors. Using --driver-class-path only works in the local mode.

In ubuntu mosquitto can be installed using the command `$ sudo apt-get install mosquitto`
Run Mqtt publisher as
`$ bin/run-example \
org.apache.spark.examples.streaming.MQTTPublisher tcp://localhost:1883 foo`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zsxwing / @tdas, the publisher here is the Scala publisher in the MQTT Scala word count example. Should we keep this here or we should update it to general instruction to run MQTT publisher.

Copy link
Member

Choose a reason for hiding this comment

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

I think that's fine. We can also add something to highlight this MQTTPublisher is only for demo / example.

@SparkQA
Copy link

SparkQA commented Jul 26, 2015

Test build #38462 has finished for PR 4229 at commit b90b709.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@zsxwing
Copy link
Member

zsxwing commented Jul 26, 2015

retest this please

@SparkQA
Copy link

SparkQA commented Jul 26, 2015

Test build #109 has finished for PR 4229 at commit b90b709.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 26, 2015

Test build #38474 has finished for PR 4229 at commit b90b709.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@zsxwing
Copy link
Member

zsxwing commented Jul 27, 2015

retest this please

@SparkQA
Copy link

SparkQA commented Jul 27, 2015

Test build #116 has finished for PR 4229 at commit b90b709.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Jul 27, 2015

Test build #38554 has finished for PR 4229 at commit b90b709.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@SparkQA
Copy link

SparkQA commented Jul 30, 2015

Test build #39036 has finished for PR 4229 at commit 126608a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@zsxwing
Copy link
Member

zsxwing commented Jul 31, 2015

@prabeesh I opened #7833 to fix the maven build issue in this PR. When my PR is merged, it will still show that you are the author. Thanks a lot for your contribution.

@SparkQA
Copy link

SparkQA commented Aug 2, 2015

Test build #39437 has finished for PR 4229 at commit 03f3e88.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class MQTTUtils(object):

@prabeesh
Copy link
Contributor Author

prabeesh commented Aug 3, 2015

@tdas please have a look.

@prabeesh
Copy link
Contributor Author

prabeesh commented Aug 4, 2015

welcome @zsxwing thanks for your great help

@zsxwing
Copy link
Member

zsxwing commented Aug 4, 2015

@prabeesh thanks for your contribution again. Actually, you don't need to update this PR. When #7833 is merged by @tdas , he will set the author to you and you will see it in the master and 1.5 branch. (The merge script will automatically choose the one with the most commits of a PR as the major author. )

@prabeesh
Copy link
Contributor Author

prabeesh commented Aug 4, 2015

I am not going to update this PR again. Can I close this PR or it automatically closes after #7833 merge ?

@zsxwing
Copy link
Member

zsxwing commented Aug 4, 2015

You can close this PR :)

@prabeesh prabeesh closed this Aug 4, 2015
asfgit pushed a commit that referenced this pull request Aug 10, 2015
This PR is based on #4229, thanks prabeesh.

Closes #4229

Author: Prabeesh K <prabsmails@gmail.com>
Author: zsxwing <zsxwing@gmail.com>
Author: prabs <prabsmails@gmail.com>
Author: Prabeesh K <prabeesh.k@namshi.com>

Closes #7833 from zsxwing/pr4229 and squashes the following commits:

9570bec [zsxwing] Fix the variable name and check null in finally
4a9c79e [zsxwing] Fix pom.xml indentation
abf5f18 [zsxwing] Merge branch 'master' into pr4229
935615c [zsxwing] Fix the flaky MQTT tests
47278c5 [zsxwing] Include the project class files
478f844 [zsxwing] Add unpack
5f8a1d4 [zsxwing] Make the maven build generate the test jar for Python MQTT tests
734db99 [zsxwing] Merge branch 'master' into pr4229
126608a [Prabeesh K] address the comments
b90b709 [Prabeesh K] Merge pull request #1 from zsxwing/pr4229
d07f454 [zsxwing] Register StreamingListerner before starting StreamingContext; Revert unncessary changes; fix the python unit test
a6747cb [Prabeesh K] wait for starting the receiver before publishing data
87fc677 [Prabeesh K] address the comments:
97244ec [zsxwing] Make sbt build the assembly test jar for streaming mqtt
80474d1 [Prabeesh K] fix
1f0cfe9 [Prabeesh K] python style fix
e1ee016 [Prabeesh K] scala style fix
a5a8f9f [Prabeesh K] added Python test
9767d82 [Prabeesh K] implemented Python-friendly class
a11968b [Prabeesh K] fixed python style
795ec27 [Prabeesh K] address comments
ee387ae [Prabeesh K] Fix assembly jar location of mqtt-assembly
3f4df12 [Prabeesh K] updated version
b34c3c1 [prabs] adress comments
3aa7fff [prabs] Added Python streaming mqtt word count example
b7d42ff [prabs] Mqtt streaming support in Python

(cherry picked from commit 853809e)
Signed-off-by: Tathagata Das <tathagata.das1565@gmail.com>
asfgit pushed a commit that referenced this pull request Aug 10, 2015
This PR is based on #4229, thanks prabeesh.

Closes #4229

Author: Prabeesh K <prabsmails@gmail.com>
Author: zsxwing <zsxwing@gmail.com>
Author: prabs <prabsmails@gmail.com>
Author: Prabeesh K <prabeesh.k@namshi.com>

Closes #7833 from zsxwing/pr4229 and squashes the following commits:

9570bec [zsxwing] Fix the variable name and check null in finally
4a9c79e [zsxwing] Fix pom.xml indentation
abf5f18 [zsxwing] Merge branch 'master' into pr4229
935615c [zsxwing] Fix the flaky MQTT tests
47278c5 [zsxwing] Include the project class files
478f844 [zsxwing] Add unpack
5f8a1d4 [zsxwing] Make the maven build generate the test jar for Python MQTT tests
734db99 [zsxwing] Merge branch 'master' into pr4229
126608a [Prabeesh K] address the comments
b90b709 [Prabeesh K] Merge pull request #1 from zsxwing/pr4229
d07f454 [zsxwing] Register StreamingListerner before starting StreamingContext; Revert unncessary changes; fix the python unit test
a6747cb [Prabeesh K] wait for starting the receiver before publishing data
87fc677 [Prabeesh K] address the comments:
97244ec [zsxwing] Make sbt build the assembly test jar for streaming mqtt
80474d1 [Prabeesh K] fix
1f0cfe9 [Prabeesh K] python style fix
e1ee016 [Prabeesh K] scala style fix
a5a8f9f [Prabeesh K] added Python test
9767d82 [Prabeesh K] implemented Python-friendly class
a11968b [Prabeesh K] fixed python style
795ec27 [Prabeesh K] address comments
ee387ae [Prabeesh K] Fix assembly jar location of mqtt-assembly
3f4df12 [Prabeesh K] updated version
b34c3c1 [prabs] adress comments
3aa7fff [prabs] Added Python streaming mqtt word count example
b7d42ff [prabs] Mqtt streaming support in Python
@prabeesh prabeesh deleted the mqtt_python branch August 11, 2015 13:24
CodingCat pushed a commit to CodingCat/spark that referenced this pull request Aug 17, 2015
This PR is based on apache#4229, thanks prabeesh.

Closes apache#4229

Author: Prabeesh K <prabsmails@gmail.com>
Author: zsxwing <zsxwing@gmail.com>
Author: prabs <prabsmails@gmail.com>
Author: Prabeesh K <prabeesh.k@namshi.com>

Closes apache#7833 from zsxwing/pr4229 and squashes the following commits:

9570bec [zsxwing] Fix the variable name and check null in finally
4a9c79e [zsxwing] Fix pom.xml indentation
abf5f18 [zsxwing] Merge branch 'master' into pr4229
935615c [zsxwing] Fix the flaky MQTT tests
47278c5 [zsxwing] Include the project class files
478f844 [zsxwing] Add unpack
5f8a1d4 [zsxwing] Make the maven build generate the test jar for Python MQTT tests
734db99 [zsxwing] Merge branch 'master' into pr4229
126608a [Prabeesh K] address the comments
b90b709 [Prabeesh K] Merge pull request #1 from zsxwing/pr4229
d07f454 [zsxwing] Register StreamingListerner before starting StreamingContext; Revert unncessary changes; fix the python unit test
a6747cb [Prabeesh K] wait for starting the receiver before publishing data
87fc677 [Prabeesh K] address the comments:
97244ec [zsxwing] Make sbt build the assembly test jar for streaming mqtt
80474d1 [Prabeesh K] fix
1f0cfe9 [Prabeesh K] python style fix
e1ee016 [Prabeesh K] scala style fix
a5a8f9f [Prabeesh K] added Python test
9767d82 [Prabeesh K] implemented Python-friendly class
a11968b [Prabeesh K] fixed python style
795ec27 [Prabeesh K] address comments
ee387ae [Prabeesh K] Fix assembly jar location of mqtt-assembly
3f4df12 [Prabeesh K] updated version
b34c3c1 [prabs] adress comments
3aa7fff [prabs] Added Python streaming mqtt word count example
b7d42ff [prabs] Mqtt streaming support in Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants