Run a specific talend component using the shell executable - talend

My question is similar to this: Execute only one talend component. Except instead of using the Talend Open Studio, I want to be able to run a specific component from the shell executable I get from building the job.
I have set up my job in a way that if a component is succeeded, the OnComponentOk trigger is used to run the next component. To run the job I run sudo bash NAME_OF_THE_JOB.sh. Is it possible to run only one component, perhaps by passing arguments to the bash shell file?

A Talend job is a single java program. Components are translated to java functions. There are no arguments that allow you to execute a single component.
What you could do is write your job in such a way to execute a component whose name is passed via a context variable but it's not pretty.
You can test the component name passed via a variable named componentName using Run If triggers:
tRunJob_1
/
if("tRunJob_1".equals(context.componentName)
/
/
Start ---if("tJava_2".equals(context.componentName))-- tJava_2
\
\
if("tRest_1".equals(context.componentName))
\
tRest_1
As you can see, this can get very cumbersome, and requires you to know the component's name in order to run it.
You can then launch your job by passing the component name as argument :
sudo bash NAME_OF_THE_JOB.sh --context_param componentName=tJava_2

Related

What does double colon :: stand for in YAML for GitHub Actions?

I'm trying to write a file in my GitHub repo with GitHub Actions. When reading the docs, I stumbled across this:
Actions can communicate with the runner machine to set environment
variables, output values used by other actions, add debug messages to
the output logs, and other tasks.
Most workflow commands use the echo command in a specific format,
while others are invoked by writing to a file. For more information,
see "Environment files".
echo "::workflow-command parameter1={data},parameter2={data}::{command value}"
I don't know Ansible so I don't understand if this is YAML syntax or Ansible syntax.
I've tried to search Google and Stack Overflow but no results for double colon or ::
Can someone give me the link to the appropriate doc for :: or explain what this command does?
in other words, what does the example in my post throws in the shell? where are data and parameter1 and parameter2 defined if they are (in the yml, in the shell/env)? is command value a value i can reuse in the yml or in the shell?
The ::command can be logged to the console by any script or executable. They are special strings the GitHub runner will detect, interpret and then take the appropriate action on.
They are essentially the communication mechanism between the runner and the thing it's currently running. Anything that can write to the console can issue these strings.
It's totally up to you to build these stings, to inject any parameters these 'magic strings' require to function.
The docs you've found are the right docs on these to understand how to log there strings and what commands there are available to you.
If you're building a GitHub action using the JavaScript/Typescript toolkit, then it provides nice wrapper functions for these commands. The JavaScript SDK also gives you a sneak peak into how to composekthese strings.
If you're building a composite action, container task or are directly issueing commands from a script block in the workflow, then it's up to you to build the correct strings and log these to the console.
More details:
https://github.com/actions/toolkit/blob/main/packages/core/README.md
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions (you had found that already)
Communicating through the console is the lowest common denominator between any tools running on just about any platform and requires no interprocess communication if any kind. It's the simplest way to communicate from a child process to it's parent.
You'd use the command to set an output variable.
echo "::set-output name=name::value"
To be able to reference the value cross at you'd reference any output variable from any action.
Or set an environment variable which will be set for the next job: echo "action_state=yellow" >> $GITHUB_ENV
See: https://stackoverflow.com/a/57989070/736079

Launch external program with multiple commands via Powershell

I am currently attempting to launch a different console (.exe) and pass multiple commands; while starting and entering a command works just fine, I haven't been able to find out how multiple ones can be entered via powershell.
& "C:\Program Files\Docker Toolbox\start.sh" docker-compose up -d --build
The given command works fine, but as mentioned I need to pass more than one command - I tried using arrays, ScriptBlocks and different sequences, though to no avail.
Edit:
Noticed that the docker build has a -f tag which allows me to specify a file; however, the issue now seems to be that the executed cmd removes all backslashes & special characters, rendering the path given useless.
Example:
&"C:\Program Files\Docker Toolbox\start.sh" 'docker-compose build -f
path\to\dockerfile'
will result in an error stating that "pathtodockerfile" is an invalid path.
Your start.sh needs to be able to handle multiple arguments. This doesn't look like a PowerShell question
Turns out that it was easier than expected; Solved it by executing a seperate file that contained the two commands needed and passing it to the start.sh file.
&"C:\Program Files\Docker Toolbox\start.sh" './xyz/fileContainingCommands.sh'

Rename the Single .exe file name parameter using command line IsCmdBld.exe Installshield

How do I specify the name for the executable using the command-line version of Installshield. I'm looking for the command line switch
I need to create a package based on the version I pass.
For ex : If I pass - 2.2.0,
SET RELEASE_VERSION="2.2.0"
ISCmdBld.exe -p "\Path\BuildProject.ism" -y %RELEASE_VERSION% -? MY_COOL_APP_%RELEASE_VERSION%.EXE
I need to know the switch (indicated as ? here) which will create MY_COOL_APP_2.2.0.exe after building and running the command line InstallShield build tool.
I tried using the values from the path variables at build time
ISCmdBld.exe -p "\Path\BuildProject.ism" -y %RELEASE_VERSION% -l MYPathVar="MY_COOL_APP_%RELEASE_VERSION%"
I have associated the value of the path variable for the single .exe file in the Project-->Settings-->Application tab but still the build gives me the default setup.exe
Much appreciate your inputs
There is no parameter for IsCmdBld.exe that directly changes the name of the resulting setup.exe file. For a couple predetermined names you could make multiple release configurations and select them (with -r, or product configurations via -a), but for your case that is unlikely to scale. Instead you should consider one of the following:
Use automation (perhaps invoke a .vbs script) to edit the release configuration, and then build the project
Build to a known name, and then rename the resulting file as the next step in your build script

How to get the final command to be executed by sshkit

I want to create a gem that has de ability to take a task and wrap all commands in another command.
For example, the capistrano3-unicorn gem unicorn:start task will execute on the server something like bundle exec unicorn -c unicorn.rb -E production, but the execute method is wrapped by a within method, so the command to be executed on the server will be something like cd /home/deploy/application/myapp/current && bundle exec unicorn -c unicorn.rb -E production
I want to be able to create a rake task that takes that unicorn:start task and wrap it inside another task.
For example if I want to create an upstart config file for the app, I could adds this command to a upstart.conf template and the run service my-unicorn-app start
That would be a use case I'm trying to pursue.
In SSHKit formatters the write command is called with a command arg that have what I'm looking for. But I need this at capistrano task level.
Thanks
I think what you're asking is how to access the exact command that is sent via SSH. What you're looking for is the #command method, on the return value of which you can call #to_command. Since #command is a private method, we need to use #send.
namespace :unicorn
task :set_restart_command do
on(roles(:web)) do
within release_path do
set(:unicorn_start_command,
send(:command, :unicorn, "-c unicorn.rb -E production").to_command)
end
end
end
end
Now, in another task, you can use fetch(:unicorn_start_command)

Matlab fails to run a script when scheduled with Task Scheduler

I am trying to start Matlab and run a script scheduled at a specific time using the windows Task Scheduler.
If I use a scheduled task I can see Matlab starting, but this last fails to load the script and returns me the error below
??? Unexpected Matlab operator.
Do you know what it is and why?
I am using the following syntax
c:\app\matlab\bin\matlab.exe -r c:\MyURL\ScriptFile.m
If I load the script manually and run it it tells me that the file is not in the path so give ms a choice between
Change Current Directory
Add Folder to the Path
Either choices are fine and the script runs fine.
Matlab is starting in its main directory and -r requires your function to be in quotation marks, thats why you get the error.
And you need to change to your workspace first, the syntax is as follows:
matlab -sd pathToYourWorkspace -r "function(parameters)"
Maybe you also want to avoid the complete loading of the whole Matlab working environment, so add at the end:
-nodesktop -nosplash
If you run your task sheduled, are you doing it multiple times? Are you aware that every function call like above opens a new instance of Matlab? This question may be helpful then.
From the comments: of course you could just use the command run to call a script wherever it is.
"run('c:\MyURL\ScriptFile.m')" is an example for "functionName(YourArgs)"
as run is a function and the string 'c:\MyURL\ScriptFile.m' its argument. In this case it is usually not necessary to change the workspace before.