Jarek,
I think this might actually be a bug in airflow. I have been using
'non-standard' cron in my airflow without any issues (30 7 * * 6#1 - first
saturday of the month). I think the problem here is that airflow seems to
convert cron specification to lowercase (check the error message during dag
import). Where as 'L' has meaning in cron, 'l' does not. You can test the
above cron in this website (https://crontab.cronhub.io/), and see that it
works for uppercase L, but ignores the lowercase L).

Thanks,
Mani

On Tue, Apr 11, 2023 at 12:01 PM Jarek Potiuk <ja...@potiuk.com> wrote:

> Yes. The crontab you specified is not "standard". Airflow's crontab
> supports classic cron specification: (example here)
> https://www.adminschoice.com/crontab-quick-reference
> <https://www.adminschoice.com/crontab-quick-reference>
>
> Custom timetable is the right way to go for you. You can also run the DAG
> every Friday and short-circuit it based on a Python code calculating if
> this is not the last Friday, but custom crontab will be nicer  to see only
> the valid dates running.
>
> J
>
> On Mon, Apr 10, 2023 at 5:54 PM Leonard Walstad
> <leonard.wals...@astronomer.io.invalid> wrote:
>
>> Dipayan;
>>
>> This looks like a good use of a timetable if you use Airflow 2.2 or
>> above:
>> https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html
>> <https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html>
>>
>> If using an earlier version, you might schedule for every Friday and
>> check to see if it is the last Friday in a ShortCircuitOperator and
>> discontinue the pipeline:
>>
>>
>> https://registry.astronomer.io/providers/apache-airflow/versions/latest/modules/shortcircuitoperator
>> <https://registry.astronomer.io/providers/apache-airflow/versions/latest/modules/shortcircuitoperator>
>>
>> Regards,
>> Leonard
>>
>>
>>
>> Leonard Walstad
>> Principal Architect / Customer Success
>>
>> Astronomer.io
>> <https://astronomer.io/>
>> leonard.wals...@astronomer.io
>> 617.320.4854
>>
>>
>> On Mon, Apr 10, 2023 at 11:09 AM Dipayan Dev <dev.dipaya...@gmail.com>
>> wrote:
>>
>>> Hi Team,
>>>
>>> I have a requirement to schedule the Airflow DAG on the last Friday of
>>> every month.
>>>
>>> I was using this cron expression which works on Linux : 0 00 16 ? * 6L.
>>> But it throws a DAG import error:
>>> *Invalid timetable expression: [0 00 16 ? * 6l] is not acceptable.*
>>>
>>>
>>> Can anyone please help on how to set the scheduler?
>>>
>>>
>>>
>>> With Best Regards,
>>>
>>> Dipayan Dev
>>>
>>>

-- 


********************************************



 

*Inmar Confidentiality 
Note*:  This e-mail and any attachments are confidential and intended to be 
viewed and used solely by the intended recipient.  If you are not the 
intended recipient, be aware that any disclosure, dissemination, 
distribution, copying or use of this e-mail or any attachment is 
prohibited.  If you received this e-mail in error, please notify us 
immediately by returning it to the sender and delete this copy and all 
attachments from your system and destroy any printed copies.  Thank you for 
your cooperation.



 

*Notice of Protected Rights*:  The removal of any 
copyright, trademark, or proprietary legend contained in this e-mail or any 
attachment is prohibited without the express, written permission of Inmar, 
Inc.  Furthermore, the intended recipient must maintain all copyright 
notices, trademarks, and proprietary legends within this e-mail and any 
attachments in their original form and location if the e-mail or any 
attachments are reproduced, printed or distributed.

 

********************************************

Reply via email to