<?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: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25760#M17967</link>
    <description>&lt;P&gt;If you are streaming to delta, not much, the micro batch will fail and in next time the stream will pick up from last successful write (due to ACID). I don't know about other formats, what happens if the stream is aborted in mid micro batch.&lt;/P&gt;</description>
    <pubDate>Tue, 23 May 2023 09:45:51 GMT</pubDate>
    <dc:creator>merca</dc:creator>
    <dc:date>2023-05-23T09:45:51Z</dc:date>
    <item>
      <title>I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25753#M17960</link>
      <description />
      <pubDate>Sun, 13 Mar 2022 18:36:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25753#M17960</guid>
      <dc:creator>Bhawna_bedi</dc:creator>
      <dc:date>2022-03-13T18:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25754#M17961</link>
      <description>&lt;P&gt;You can use the CLI &lt;A href="https://docs.databricks.com/dev-tools/cli/index.html" target="test_blank"&gt;https://docs.databricks.com/dev-tools/cli/index.html&lt;/A&gt; to schedule a job and you can also schedule a cluster to terminate through API calls.  There are also integrations with tools such as airflow and azure data factory.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2022 23:17:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25754#M17961</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-13T23:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25756#M17963</link>
      <description>&lt;P&gt;You could set up schedule to start 6am and timeout seconds to 39 600 that is 11 hours. With max retries to 1. There is a downside to it - if your stream fails in the middle of day - it will run for 11 hours regardless when it stops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 17:19:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25756#M17963</guid>
      <dc:creator>merca</dc:creator>
      <dc:date>2022-04-02T17:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25758#M17965</link>
      <description>&lt;P&gt;If you are looking for a graceful stop (Not to stop exactly at 5 but stop after the micro-batch that was in progress at 5 o clock instead of abruptly stopping the stream), you can try the following. The downside is if the micro batch duration is high, stream stop will be delayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import java.time.LocalTime
val queryStopListner = new StreamingQueryListener() {
    override def onQueryStarted(queryStarted: StreamingQueryListener.QueryStartedEvent): Unit = {
      
    }
    override def onQueryTerminated(queryTerminated: StreamingQueryListener.QueryTerminatedEvent): Unit = {
      
    }
    override def onQueryProgress(queryProgress: StreamingQueryListener.QueryProgressEvent): Unit = {
      
      val id = queryProgress.progress.id
      if(LocalTime.now().isAfter(LocalTime.parse("17:00:00"))){
        val currentStreamingQuery = spark.streams.get(id)  
        currentStreamingQuery.stop
      }
    }
}
&amp;nbsp;
//Add this query listner to the session
spark.streams.addListener(queryStopListner)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 20:50:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25758#M17965</guid>
      <dc:creator>Sandeep</dc:creator>
      <dc:date>2022-07-14T20:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25759#M17966</link>
      <description>&lt;P&gt;Might anybody knows what will happen if I set task timeout in Workflows for the Streaming job?&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 21:00:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25759#M17966</guid>
      <dc:creator>DimaP</dc:creator>
      <dc:date>2023-05-22T21:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: I want to run a streaming job from morning 6a.m to evening 5p.m how can I schedule this window in databricks. Or how can u stop my stream at 5pm?</title>
      <link>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25760#M17967</link>
      <description>&lt;P&gt;If you are streaming to delta, not much, the micro batch will fail and in next time the stream will pick up from last successful write (due to ACID). I don't know about other formats, what happens if the stream is aborted in mid micro batch.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 09:45:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-want-to-run-a-streaming-job-from-morning-6a-m-to-evening-5p-m/m-p/25760#M17967</guid>
      <dc:creator>merca</dc:creator>
      <dc:date>2023-05-23T09:45:51Z</dc:date>
    </item>
  </channel>
</rss>

