<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to specify entry_point for python_wheel_task? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/77341#M35428</link>
    <description>&lt;P&gt;You are a hero for supplying a full example - especially the validation part is great. Thanks dude!&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 09:43:40 GMT</pubDate>
    <dc:creator>VictorS</dc:creator>
    <dc:date>2024-07-09T09:43:40Z</dc:date>
    <item>
      <title>How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32020#M23340</link>
      <description>&lt;P&gt;Can someone provide me an example for a python_wheel_task and what the entry_point field should be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The jobs UI help popup says this about "entry_point":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Function to call when starting the wheel, for example: main. If the entry point does not exist in the meta-data of the wheel distribution, the function will be called directly using `$packageName.$entryPoint()`."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, an entry point in python is a combination of the group and a name. e.g. in my setup.py&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;entry_points = {
    'my_jobs': [
        'a_job = module_name:job_function'
   ]
},&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here the group is "my_jobs" and the name is "a_job". For databricks, should I make entry_point `a_job`, `my_jobs.a_job`, or does databricks require a specific group name for wheels that are run as tasks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I couldn't find any documentation online to clarify this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 00:12:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32020#M23340</guid>
      <dc:creator>jpwp</dc:creator>
      <dc:date>2022-01-10T00:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32023#M23343</link>
      <description>&lt;P&gt;Hi Kaniz - I'm afraid that doesn't answer the question. I am asking about the expected value for the entry_point field. I am not trying to use an additional library, I am trying to run a python_wheel_task.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 18:54:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32023#M23343</guid>
      <dc:creator>jpwp</dc:creator>
      <dc:date>2022-01-10T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32025#M23345</link>
      <description>&lt;P&gt;@Joel Pitt​&amp;nbsp;- Let us know if either of Kaniz's resources helps you. If they do, would you be happy to mark that answer as best? That helps other members find the solutions more quickly. &lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 16:03:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32025#M23345</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-01T16:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32026#M23346</link>
      <description>&lt;P&gt;The correct answer to my question is that the "entry_point" in the databricks API has nothing to do with a python wheel's official "entry_point"s. It is just a dotted python path to a python function. e.g. `mymodule.myfunction`&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 19:57:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/32026#M23346</guid>
      <dc:creator>jpwp</dc:creator>
      <dc:date>2022-02-01T19:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/46825#M28135</link>
      <description>&lt;P&gt;Just in case anyone comes here in the future, this is kind of how Databricks executes these entry points... How I know? I have banged my head against this wall for a couple of hours already.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from importlib import metadata

package_name = "some.package"
entry_point = "my-entry-point"

available_entry_point = metadata.distribution(package_name).entry_points
entry = [ep for ep in available_entry_points if ep.name = entry_point]

if entry:
    enstry[0].load()()
else:
    # Imagine that &amp;lt;package-name&amp;gt; is replaced with the package name provided
    # and same for &amp;lt;entry-point&amp;gt;
    import &amp;lt;package-name&amp;gt;
    &amp;lt;package-name&amp;gt;.&amp;lt;entry-point&amp;gt;()&lt;/LI-CODE&gt;&lt;P&gt;If you cannot see your entry point usint the following, then you (we) are out of luck.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from importlib import metadata
from pprint import pprint

package_name = "my.package"
pprint(metadata.distribution(package_name).entry_points)&lt;/LI-CODE&gt;&lt;P&gt;My current working theory is that the user installing the package is not the same user running the execution. Or for some weird reason the metadata is not available at the job runtime...&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 15:23:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/46825#M28135</guid>
      <dc:creator>hectorfi</dc:creator>
      <dc:date>2023-09-29T15:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/46859#M28139</link>
      <description>&lt;P&gt;How do you build the wheel? I got it working with poetry like so:&lt;BR /&gt;&lt;BR /&gt;entrypoint.py somewhere in your codebase:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def entrypoint():
    print("Works")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pyproject.toml:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[tool.poetry]
name = "package"
version = "1.0.0"
description = "package"
packages = [{include = "src"}, ]  # assuming you have the /src structure

[tool.poetry.scripts]
my_entrypoint = "src.entrypoint:entrypoint" # before : is path to file and after is method name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Job config:&lt;BR /&gt;&amp;nbsp; package_name: 'package' --&amp;gt; taken from pyproject.toml&lt;BR /&gt;&amp;nbsp; entrypoint: 'my_entrypoint' --&amp;gt; taken from the&amp;nbsp;pyproject.toml before the `=` of your entrypoint line&lt;/P&gt;&lt;P&gt;(assuming your installed the wheel on the cluster)&lt;BR /&gt;&lt;BR /&gt;I also pulled my hair out over this and am now bald.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FYI, my full setup is micromamba -&amp;gt; poetry -&amp;gt; gitlab -&amp;gt; pulumi -&amp;gt; databricks&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":skull_and_crossbones:"&gt;☠️&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 20:50:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/46859#M28139</guid>
      <dc:creator>GabMorin</dc:creator>
      <dc:date>2023-09-29T20:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/49728#M28611</link>
      <description>&lt;P&gt;One thing to note when working with entry points is that if the name is too long, it may not work on Databricks. That was the cause of my issue.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 11:49:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/49728#M28611</guid>
      <dc:creator>hectorfi</dc:creator>
      <dc:date>2023-10-23T11:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/77341#M35428</link>
      <description>&lt;P&gt;You are a hero for supplying a full example - especially the validation part is great. Thanks dude!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 09:43:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/77341#M35428</guid>
      <dc:creator>VictorS</dc:creator>
      <dc:date>2024-07-09T09:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/90839#M38004</link>
      <description>&lt;P&gt;Just want to confirm - my project uses PDM not poetry&lt;/P&gt;&lt;P&gt;and as such uses&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[project.entry-points.packages]&lt;/LI-CODE&gt;&lt;P&gt;Rather than&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[tool.poetry.scripts]&lt;/LI-CODE&gt;&lt;P&gt;and the bundle is failing to run on the cluster - as it can't find the entry point - is this expected behavior?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 08:30:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/90839#M38004</guid>
      <dc:creator>MRMintechGlobal</dc:creator>
      <dc:date>2024-09-18T08:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify entry_point for python_wheel_task?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/90841#M38005</link>
      <description>&lt;P&gt;My issue appears to have been uploading wheel with identical version numbers during development.&lt;BR /&gt;&lt;BR /&gt;I've added dynamic versioning to the packages using git hash and timestamp to ensure the latest is installed and runs.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def get_version(version=__version__):
    try:
        import subprocess

        git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode("ascii").strip()
        version += f"+{git_hash}-{int(time.time())}"
    except Exception as e:
        print(e)
    return version&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 08:38:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-specify-entry-point-for-python-wheel-task/m-p/90841#M38005</guid>
      <dc:creator>MRMintechGlobal</dc:creator>
      <dc:date>2024-09-18T08:38:18Z</dc:date>
    </item>
  </channel>
</rss>

