Re: PgAgent Patch

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, Mehmet Emin KARAKAŞ <emin100(at)gmail(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PgAgent Patch
Date: 2015-03-05 09:37:07
Message-ID: CANxoLDe-rHNH3yZLn1BXWQZxC6hsnsYjOpkqe1Uvbxg7ZSRzPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Mehmet

I have added the logic in job.cpp file to read the error message, If batch
job is failed. Attached is the patch file and job.cpp with the email.
I haven't tested it because facing some difficulty in linking the project
on Windows. Can you please apply the patch and test it at your end, also if
you seen some modification please feel free to do it.

On Wed, Mar 4, 2015 at 4:22 PM, Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
wrote:

> Sure.
>
> On Wed, Mar 4, 2015 at 4:20 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>>
>>
>> On Wed, Mar 4, 2015 at 10:48 AM, Akshay Joshi <
>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>
>>> Dave,
>>>
>>> On Wed, Mar 4, 2015 at 4:11 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>> Hi,
>>>>
>>>> Mehmet may not be able to work on Windows, so one of us may have to
>>>> deal with that. Did we not solve this already in PEM btw?
>>>>
>>>
>>> Yes we have solved it in PEM, I have send the source code in my
>>> previous email.
>>>
>>
>> Oh, that was it? Well that code is pretty well tried and tested, so maybe
>> we should just use that. Perhaps you can send Mehmet a patch to test on his
>> build?
>>
>>
>>>
>>>> On Wed, Mar 4, 2015 at 10:16 AM, Akshay Joshi <
>>>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Hi Mehmet
>>>>>
>>>>> I have reviewed the patch, but it is only for nix machine. Can you
>>>>> please provide a patch where it should be fixed for Windows as well. I
>>>>> have implemented the same in one of my project using below logic which
>>>>> works for both windows and nix. You can tried out the below logic
>>>>>
>>>>> errFile = 'xyz.txt';
>>>>> FILE *fpError = freopen(errFile.mb_str(), "w", stderr); .... .... //
>>>>> If output is empty then either job did not return any output // or job
>>>>> threw some error into stderr. if (output == wxEmptyString) { // Check
>>>>> script threw some error into stderr if (fpError) { fclose(fpError);
>>>>> fpError = fopen(errFile.mb_str(), "r"); if (fpError) { char buffer
>>>>> [4098]; wxString errorMsg = wxEmptyString; while (!feof(fpError)) {
>>>>> if (fgets(buffer, 4096, fpError) != NULL) errorMsg += wxString(buffer,
>>>>> wxConvLibc); } fclose(fpError); } } }
>>>>>
>>>>> On Wed, Mar 4, 2015 at 10:41 AM, Ashesh Vashi <
>>>>> ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>
>>>>>> Sure
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Thanks & Regards,
>>>>>>
>>>>>> Ashesh Vashi
>>>>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>>>>>> <http://www.enterprisedb.com>
>>>>>>
>>>>>>
>>>>>> *http://www.linkedin.com/in/asheshvashi*
>>>>>> <http://www.linkedin.com/in/asheshvashi>
>>>>>>
>>>>>> On Tue, Mar 3, 2015 at 2:01 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>>>>
>>>>>>> Ashesh; can you please get this reviewed and applied if it looks OK?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> On Tue, Mar 3, 2015 at 12:00 PM, Mehmet Emin KARAKAŞ <
>>>>>>> emin100(at)gmail(dot)com> wrote:
>>>>>>> > Hi,
>>>>>>> > If batch cron is failed, pgagent doesn't receive error messages.
>>>>>>> We fix it.
>>>>>>> > We canalized the stderr to stdout. This patch batch cron receive
>>>>>>> error
>>>>>>> > massages from nix machine. Git Diff Message and job.cpp file is
>>>>>>> attached.
>>>>>>> >
>>>>>>> > Thanks.
>>>>>>> >
>>>>>>> > --
>>>>>>> > MEHMET EMİN KARAKAŞ
>>>>>>> > Postgresql Global Username: emin100
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > diff --git a/job.cpp b/job.cpp
>>>>>>> > index 00334ab..694be22 100644
>>>>>>> > --- a/job.cpp
>>>>>>> > +++ b/job.cpp
>>>>>>> > @@ -273,8 +273,11 @@ int Job::Execute()
>>>>>>> > // The *nix way.
>>>>>>> > FILE *fp_script;
>>>>>>> > char buf[4098];
>>>>>>> > +
>>>>>>> > + wxString wxSt = wxT("");
>>>>>>> > + wxSt.Printf( _("%s 2>&1"), filename.c_str());
>>>>>>> >
>>>>>>> > - fp_script =
>>>>>>> > popen(filename.mb_str(wxConvUTF8), "r");
>>>>>>> > + fp_script =
>>>>>>> popen(wxSt.mb_str(wxConvUTF8) ,
>>>>>>> > "r");
>>>>>>> > if (!fp_script)
>>>>>>> > {
>>>>>>> > output.Printf(_("Couldn't
>>>>>>> execute
>>>>>>> > script: %s, errno = %d"), filename.c_str(), errno);
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > --
>>>>>>> > Sent via pgadmin-hackers mailing list (
>>>>>>> pgadmin-hackers(at)postgresql(dot)org)
>>>>>>> > To make changes to your subscription:
>>>>>>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>>> >
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Dave Page
>>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>>> Twitter: @pgsnake
>>>>>>>
>>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Sent via pgadmin-hackers mailing list (
>>>>>>> pgadmin-hackers(at)postgresql(dot)org)
>>>>>>> To make changes to your subscription:
>>>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Akshay Joshi*
>>>>> *Principal Software Engineer *
>>>>>
>>>>>
>>>>>
>>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91
>>>>> 976-788-8246*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>

--
*Akshay Joshi*
*Principal Software Engineer *

*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*

Attachment Content-Type Size
batch_cron_error.patch application/octet-stream 2.1 KB
job.cpp text/x-c++src 11.0 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2015-03-05 09:37:43 pgAdmin III commit: Modify builddocs.bat to ensure it works with static
Previous Message Dave Page 2015-03-05 09:36:53 pgAdmin III commit: Modify builddocs.bat to ensure it works with static