• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Problem with context variables

#1 2012-05-30 14:52:37

raghu12345
Member
Registered: 2011-05-20
Posts: 52

Problem with context variables

i tried to use 2 context variables for fetching max id value of 2 tables,
it is fetching correctly later i am using this max values in 2 sub jobs for sequence number along with data as follows


tmssqlinput---->tjavarow---->(component ok)--->tmssqlinput---->tmap----->tmssqloutput


tmssqlinput---->tjavarow---->(component ok)--->tmssqlinput---->tmap----->tmssqloutput

running these 2 subjobs parallely by using tparallelize component


it is giving sequence no as

1
2
3
4
5
7
9
11
and so on for first table

6
8
10
12
14
16
and so on for second table

Last edited by raghu12345 (2012-06-01 14:21:05)

Offline

#2 2012-05-30 16:35:45

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1123

Re: Problem with context variables

What do you expect? If you want independant sequences use different sequence id.

Offline

#3 2012-05-31 08:52:36

raghu12345
Member
Registered: 2011-05-20
Posts: 52

Re: Problem with context variables

i want sequence number.
after loading first time and when i need to load data again into  same tables, it should start the sequence number
from max of sequence number already inserted into table.

for example

for fisrt load

1
2
3
4
and so on upto 1034

for second load it should start from 1035 number

1035
1036
1037
and so on

for saving the previous load max number i am using context variable

It is working fine for one job but i need to run 2 subjobs parallely so i used 2 context variable for each job
then it is mulfunctioning

Offline

#4 2012-06-01 14:18:45

raghu12345
Member
Registered: 2011-05-20
Posts: 52

Re: Problem with context variables

when i run the jobs separately the context variable works fine but when i run the same jobs parallely the sequence number is not coming correctly as required. my job structure looks looks like this




tparallelize-------(job1)
        |
        |
         ------------(job2)

and each jobs is like

tmssqlinput---->tjavarow---->(component ok)--->tmssqlinput---->tmap----->tmssqloutput

1)  In first tmssqlinput i am fetching maximum seq num
2)  In tjavarow i am saving the maximum seq value in context variable
3)  In tmap i use the same context variable in Numeic.sequnce("S1",context.v1,1)

I am using same logic in both jobs

Last edited by raghu12345 (2012-06-01 14:32:35)

Offline

#5 2012-06-01 14:55:52

djugal
Member
Registered: 2011-06-16
Posts: 229
Website

Re: Problem with context variables

it cant work in parallel as the sequence of execution of job 1 has to be completed to fetch the last record
try onsubjobok

Offline

#6 2012-06-04 07:53:32

raghu12345
Member
Registered: 2011-05-20
Posts: 52

Re: Problem with context variables

sorry you are not getting my problem.

I have two jobs named job1 and job2 with the following flow.


job1----------->tmssqlinput---->tjavarow---->(component ok)--->tmssqlinput---->tmap----->tmssqloutput

and i am using
1)  In first tmssqlinput i am fetching maximum seq num
2)  In tjavarow i am saving the maximum seq value in context variable
3)  In tmap i use the same context variable in Numeic.sequnce("S1",context.v1,1)

The job2 is similar to job1 as follows

job2---------->tmssqlinput---->tjavarow---->(component ok)--->tmssqlinput---->tmap----->tmssqloutput

and i am using
1)  In first tmssqlinput i am fetching maximum seq num
2)  In tjavarow i am saving the maximum seq value in context variable
3)  In tmap i use the same context variable in Numeic.sequnce("S1",context.v1,1)


when i run single job at once it will load correctly but I need to run these two jobs at the same time then the problem comes when i run the below job

tparallelize-------(job1)
        |
        |
         ------------(job2)

Last edited by raghu12345 (2012-06-04 08:29:04)

Offline

#7 2012-06-04 17:46:50

djugal
Member
Registered: 2011-06-16
Posts: 229
Website

Re: Problem with context variables

you see the user guide mentions that in parallel processing context/global variables does not work.

you have to do a onsubjobok, else you can use a bulk load to load load data faster if needed.

Offline

#8 2012-06-05 06:11:35

raghu12345
Member
Registered: 2011-05-20
Posts: 52

Re: Problem with context variables

thank you Djugal

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Problem with context variables

Board footer

Powered by FluxBB