I have a deno repository of my own. I have recently switched to a new machine, and I have git clone'd that repository to my new machine.
Now when I run deno task start, it fails with this error
❯ deno task start
Task start deno run -A --watch=static/,routes/ dev.ts
Watcher Process started.
The manifest has been generated for 3 routes and 2 islands.
error: The source code is invalid, as it does not match the expected hash in the lock file.
Specifier: https://esm.sh/*preact-render-to-string#5.2.4
Lock file: /Users/john/my-project/deno.lock
I have read this page, but it is not telling me exactly what to do for my error
https://deno.land/manual#v1.29.4/basics/modules/integrity_checking
Based off of what that page says, the contents of one of your dependencies has changed since your original computer downloaded it for the first time, so the hash of the contents are different.
If you just want to ignore this, it says to use the flags
--lock=deno.lock --lock-write
which I assume means to run
deno task start --lock=deno.lock --lock-write
This will overwrite the current lock file with the new version of the code.
While this will work, the better option for the future is to specify the version in your dependency url.
For example, instead of
import { z } from "https://deno.land/x/zod/mod.ts";
you should say
import { z } from "https://deno.land/x/zod#v3.20.2/mod.ts";
(the #v3.20.2 specfies the exact dependency version)
My robot framework test contains part, where I run .exe file. I am using Run process keyword from Process library.
${result} Run Process path_to_the_file/file.exe cwd=path_to_the_file/
When I run this locally, the file is executed and response is like this:
14:35:34.553 INFO Waiting for process to complete.
14:35:34.634 INFO Process completed.
14:35:34.634 TRACE Return: <robot.libraries.Process.ExecutionResult object at 0x055963D0>
14:35:34.634 INFO ${result} = <result object with rc 0>
When I run this test on Team City, the file is not executed ( properly )
5:27:27.587 INFO Waiting for process to complete.
15:27:27.786 INFO Process completed.
15:27:27.786 TRACE Return: <robot.libraries.Process.ExecutionResult object at 0x012C1310>
15:27:27.786 INFO ${result} = <result object with rc 3221225781>
Edit: I tried google for that return code from Team city run and I found something like this:
3221225781 = [$id=DLL_NOT_FOUND, $desc={Unable To Locate Component}
This application has failed to start because %hs was not found.
Reinstalling the application may fix this problem.]
Does anyone have this sort of experience and what can I do with it?
EDIT2: after deeper analysis I found out, that there are missing DLLs on the agent. So once I'll add missing DLLs I'll know if that was a source of this isue
So the solution for this issue was to add missing DLLs. Once I added the newest version of Microsoft Visual C++ package, the Run Process executed the .exe file properly.
I am trying to run the example grakn migration "phone_calls" (using python and JSON files).
Before reaching there, I need to load the schema, but I am having trouble with getting the schema loaded, as shown here: https://dev.grakn.ai/docs/examples/phone-calls-schema
System:
-Mac OS 10.15
-grakn-core 1.8.3
-python 3.7.3
The grakn server is started. I checked and the 48555 TCP port is open, so I don't think there is any firewall issue. The schema file is in the same folder (phone_calls) as where the json data files is, for the next step. I am using a virtual environment. The error is below:
(project1_env) (base) tiffanytoor1#MacBook-Pro-2 onco % grakn server start
Storage is already running
Grakn Core Server is already running
(project1_env) (base) tiffanytoor1#MacBook-Pro-2 onco % grakn console --keyspace phone_calls --file phone_calls/schema.gql
Unable to create connection to Grakn instance at localhost:48555
Cause: io.grpc.StatusRuntimeException
UNKNOWN: Could not reach any contact point, make sure you've provided valid addresses (showing first 1, use getErrors() for more: Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=5f59fd46): com.datastax.oss.driver.api.core.connection.ConnectionInitException: [JanusGraph Session|control|connecting...] init query OPTIONS: error writing ). Please check server logs for the stack trace.
I would appreciate any help! Thanks!
Nevermind -- I found the solution, in case any one else runs into a similar problem. The server configuration file needs to be edited: point the data directory to your project data files (here: the phone_calls data files) & change the server IP address to your own.
I'm trying to setup a simple beakr service in Windows that implements the example at https://github.com/MazamaScience/beakr. I'm able to run the script from the command line successfully and I've been able to add the service in Windows using NSSM, but I am unable to start the service.
When I dig into the service error logs I see that Rscript.exe cannot be executed due to a non-specific permissions problem.
My Rscript.exe is running out of C:\Program Files\R<Version>\bin and my beakr.R script is running out of my User home directory.
If anyone has had success implementing a similar service (Web page based REST endpoint) using R in Windows, I would love to know how you did it.
This is what I did to run an R script as Service using latest pre-release version of NSSM on Windows 10:
Create a directory to store the files
In this example : C:\R\ServiceTest
Create in this directory a never ending script : ServiceTest.R
library(beepr)
# Test script : beeps every 10 seconds
while (T) {
beepr::beep(1)
if (interactive()) {
# Shows spin cursor to facilitate test in interactive mode
for (i in 1:10) {
if (i%%4==0) {cursor <- '/'}
if (i%%4==1) {cursor <- '-'}
if (i%%4==2) {cursor <- '\\'}
if (i%%4==3) {cursor <- '|'}
cat('\r',cursor)
flush.console()
Sys.sleep(1)
}
} else {
Sys.sleep(10)
}
}
I used to let this kind of script run in a console open on my desktop to check various alarms regularly.
Create a batch file to run the script : ServiceTest.bat
Rscript ServiceTest.R
Open an Admin console and make sure the batch file runs correctly:
C:\R\ServiceTest>ServiceTest.bat
C:\R\ServiceTest>Rscript ServiceTest.R
|
Cancel the batch (Ctrl+C)
Using the Admin console, install the batch file as service using NSSM :
nssm install
Set Service name : ServiceTest
Set Application path : C:\R\ServiceTest\ServiceTest.bat
Set Working directory : C:\R\ServiceTest\
Set Logon : Windows User + Password
Install Service
Open Windows Services Manager, find ServiceTest and start it : if everything went well, that's it!
If you get an error message, check Windows Event Log / Services : you can find there hints on the cause of the problem. Most common problems I encountered :
error on path
used local user instead of own user account / password to run the service
If you want to remove the service :
nssm remove ServiceTest
This replaced very nicely the many R consoles I left running in the background on my Desktop.
I see no reasons it wouldn't work with a REST endpoint.
I have written an R script that pulls some data from a database, performs several operations on it and post the output to a new database.
I would like this script to run every day at a specific time but I can not find any way to do this effectively.
Can anyone recommend a resource I could look at to solve this issue? I am running this script on a Windows machine.
Actually under Windows you do not even have to create a batch file first to use the Scheduler.
Open the scheduler: START -> All Programs -> Accesories -> System Tools -> Scheduler
Create a new Task
under tab Action, create a new action
choose Start Program
browse to Rscript.exe which should be placed e.g. here:
"C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe"
input the name of your file in the parameters field
input the path where the script is to be found in the Start in field
go to the Triggers tab
create new trigger
choose that task should be done each day, month, ... repeated several times, or whatever you like
Supposing your R script is mytest.r, located in D:\mydocuments\, you can create a batch file including the following command:
C:\R\R-2.10.1\bin\Rcmd.exe BATCH D:\mydocuments\mytest.r
Then add it, as a new task, to windows task scheduler, setting there the triggering conditions.
You could also omit the batch file. Set C:\R\R-2.10.1\bin\Rcmd.exe in the program/script textbox in task scheduler, and give as Arguments the rest of the initial command: BATCH D:\mydocuments\mytest.r
Scheduling R Tasks via Windows Task Scheduler (Posted on February 11, 2015)
taskscheduleR: R package to schedule R scripts with the Windows task manager (Posted on March 17, 2016)
EDIT
I recently adopted the use of batch files again, because I wanted the cmd window to be minimized (I couldn't find another way).
Specifically, I fill the windows task scheduler Actions tab as follows:
Program/script:
cmd.exe
Add arguments (optional):
/c start /min D:\mydocuments\mytest.bat ^& exit
Contents of mytest.bat:
C:\R\R-3.5.2\bin\x64\Rscript.exe D:\mydocuments\mytest.r params
Now there is built in option in RStudio to do this, to run scheduler first install below packages
install.packages('data.table')
install.packages('knitr')
install.packages('miniUI')
install.packages('shiny')
install.packages("taskscheduleR", repos = "http://www.datatailor.be/rcube", type =
"source")
After installing go to
**TOOLS -> ADDINS ->BROWSE ADDINS ->taskscheduleR -> Select it and execute it.**
Setting up the task scheduler
Step 1) Open the task scheduler (Start > search Task Scheduler)
Step 2) Click "Action" > "Create Task"
Step 3) Select "Run only when the user is logged on", uncheck "Run with highest priveledges", name your task,
configure for "Windows Vista/Windows Server 2008"
Step 4) Under the "Triggers" tab, set when you would like the script to run
Step 5) Under the "Actions" tab, put the full location of the Rscript.exe file, i.e.
"C:\Program Files\R\R-3.6.2\bin\Rscript.exe" (include the quotes)
Put the name of your script with with -e and source() in arguments wrapping it like this:
-e "source('C:/location_of_my_script/test.R')"
Troubleshooting a Rscript scheduled in the Task Scheduler
When you run a script using the Task Scheduler, it is difficult to troubleshoot any issues because you don't get any error messages.
This can be resolved by using the sink() function in R which will allow you to output all error messages to a file that you specify. Here is how you can do this:
# Set up error log ------------------------------------------------------------
error_log <- file("C:/location_of_my_script/error_log.Rout", open="wt")
sink(error_log, type="message")
try({
# insert your code here
})
The other thing that you will have to change to make your Rscript work is to specify the full file path of any file paths in your script.
This will not work in task scheduler:
source("./functions/import_function.R")
You will need to specify the full file path of any scripts you are sourcing within your Rscript:
source("C:/location_of_my_script/functions/import_function.R")
Additionally, I would remove any special characters from any file paths that you are referencing in your R script. For example:
df <- fread("C:/location_of_my_data/file#2342.csv")
may not run. Instead, try:
df <- fread("C:/location_of_my_data/file_2342.csv")
Changing windows passwords
Beware: Changing windows passwords will pause your task scheduler script(s). You will need to log back into the task scheduler and enter your password to get them started again.
I set up my tasks via the SCHTASKS program. For running scripts on startup, you would write something along the lines of
SCHTASKS /Create /SC ONSTART /TN MyProgram /TR "R CMD BATCH --vanilla d:\path\to\script.R"
See this website for more details on SCHTASKS. More details at Microsoft's website.
You can use Windows Task Scheduler.
After following any combination of these steps and you receive the "Argument Batch Ignored" error after R.exe runs, try this, it worked for me.
In Windows Task Scheduler:
Replace BATCH "C:\Users\desktop\yourscript.R"in the arguments field
with
CMD BATCH --vanilla --slave "C:\Users\desktop\yourscript.R"